Hacker News new | ask | show | jobs
by westurner 2136 days ago
No, it's easy for library maintainers to offer a compat API in addition to however else they feel they need to differentiate and optimize the interfaces for array operations. People can contribute such APIs directly to libraries once instead of creating many conditionals in every library-utilizing project or requiring yet another dependency on an adapter / facade package that's not kept in sync with the libraries it abstracts.

If a library chooses to implement a spec compatability API, they do that once (optimally, as compared with somebody's hackish adapter facade which has very little comprehension of each library's internals) and everyone else's code doesn't need to have conditionals.

Each of L libraries implements a compat API: O(L)

Each of U library utilizers implements conditionals for every N places arrays are utilized: O(U x N_)

Each of U library utilizers uses the common denominator compat API: O(U)

L < U < (L + U) < (U x N_)