[erlang-questions] maps and lager: how to handle new type gracefully?
Anthony Ramine
n.oxyde@REDACTED
Wed Apr 30 09:52:12 CEST 2014
Maybe we should finally remove the 'Not Yet Implemented' compile error triggered by epp when trying to use '-if' instead of '-ifdef'.
Regards,
--
Anthony Ramine
Le 30 avr. 2014 à 07:55, alisdair sullivan <alisdairsullivan@REDACTED> a écrit :
>
> On Apr 29, 2014, at 5:21 AM, Max Lapshin <max.lapshin@REDACTED> wrote:
>
>> huh, rather complicated, but ok, it will work.
>>
>> Thanks.
>>
>
> i handled this problem in jsx by adding a `rebar.config.script` with the following contents:
>
> case os:getenv("JSX_NOMAPS") or proplists:get_value(jsx_nomaps, CONFIG, false) of
> false ->
> try file:script("config/maps") of
> {ok, true} -> [{erl_opts, [{d, maps_support}]}] ++ CONFIG;
> _ -> CONFIG
> catch _:_ -> CONFIG
> end;
> _ -> CONFIG
> end.
>
> `config/maps` is just
>
> maps:keys(#{0 => false, 1 => true}) == [0,1].
>
> if you use more features of maps you can test for them also with a more complicated expression
>
> then all map related code in jsx itself goes inside ifdefs guarded by `maps_support`
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list