A way to handle backwards compatibility

I was making changes to some older projects and wanted to quickly fix few warnings, e.g.

warning: String.to_char_list/1 is deprecated, use String.to_charlist/1

I could just change these and it’ll probably work, but I wanted to know if I can safely do this without it breaking on deploy since the server would have older Elixir version. What I’d like to have would be some kind of notice similar to Clojure’s :added (s. https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L94 ) though I don’t see anything similar in Elixir’s source.

So, is there a way to determine the backwards compatibility of a function without switching the local version of Elixir?

This seems addressed in Elixir 1.6 with @since https://elixir-lang.org/blog/2018/01/17/elixir-v1-6-0-released/

1 Like

Thanks, that’s it, @since would be exactly what I meant. It’s also a simple attribute that can be safely added at any point and 1.6 is out, any idea why is there no @since here https://github.com/elixir-lang/elixir/blob/v1.6.2/lib/elixir/lib/string.ex#L2029 ?