Follow

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.

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

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!