My code depends on a library that makes liberal use of patching (replacing text in source code) for its own dependencies. I feel this is bad form, because, for example, that dependency may now conflict irreconcilably with another dependency of mine.

Am I right in thinking patching code is bad form?

  • kibiz0r@midwest.social
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 days ago

    Patching a library is fine if you’re building a final executable — something where you know what the final dependency graph looks like ahead of time.

    It’s not fine if you’re building a library. You don’t know if a consumer will also want to use an unpatched version of that library, and depending on the scenario that could result in duplicated instances (each with their own internal state), failure to build or load, or mismatches in data layout or function definitions.

    I would avoid using a library like that if I could.

    Of course, sometimes the person who can make that decision is the creator of npm itself, and says “No I don’t believe I will”: https://github.com/isaacs/jackspeak/issues/20