What’s the nicest way for an Elixir library to depend on either Jason *or* Poison? Ideally, it’d be like an optional dependency which uses whatever’s available. The libary needs a JSON encoder to function, though, so I can’t make them both optional.

Follow

I’m leaning towards making both of them optional anyway, having users explicitly depend on a JSON encoder and figuring out which one’s available in the library itself. That won’t affect most users, as most projects have at least one of them available. 🤔

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!