[erlang-questions] maps and lager: how to handle new type gracefully?

Loïc Hoguin essen@REDACTED
Tue Apr 29 14:09:57 CEST 2014


If you use the fully qualified erlang:is_map(Var) and map:to_list(Var) 
you can easily handle maps in a backward compatible way.

On 04/29/2014 02:05 PM, Max Lapshin wrote:
> Hi, I've got problem with using maps:
> https://github.com/basho/lager/issues/218
>
> Right now lager (and especially version 2.0.2) cannot print maps. It
> leads to severe problems in my case, but it is another story.
>
>
> If map support will be added to lager master, it means that R16 users
> will not be able to use it.
>
> Maybe I've missed some thread, but is it possible to write something like:
>
> format(...) ->
>     ...;
>
> -ifdef(R17)
> format(#{key => Value}) ->
>     ...;
>
> -endif.
>
> format(Else) ->
>     ...
>
> Is there any preprocessor directive that will help to distinguish 17+
> from R16- ?
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list