[erlang-bugs] Match error when mapping a list of maps with anonymous functions in the shell
Anthony Ramine
n.oxyde@REDACTED
Sun May 4 14:04:47 CEST 2014
Because it makes the evaluation order relevant to scoping, while it shouldn’t be.
Compare with:
[(fun (Y) -> X = Y end)(ok),X=not_ok].
[case ok of ok -> X = ok; _ -> ok end,X=not_ok].
Also, Björn-Egil confirmed that the expression with the fun is indeed a bug. Nobody confirmed anything for the case with the unsafe X though.
The Erlang documentation agrees that there is no defined evaluation order.
And erl_lint agrees with me that the X in the fun shouldn’t match against the previous X, claiming both are unused.
In both cases, I think the X in the fun (or the case) shouldn’t match against anything and just be declared as unused by erl_lint.
Ideally, such code would just be forbidden by erl_lint because it is confusing.
--
Anthony Ramine
Le 4 mai 2014 à 13:00, Kostis Sagonas <kostis@REDACTED> a écrit :
> On 05/04/2014 11:13 AM, Anthony Ramine wrote:
>> Now the only remaining bug concerns some edge cases:
>>
>> [X=not_ok,(fun (Y) -> X = Y end)(ok)].
>> [X=not_ok,case ok of ok -> X = ok; _ -> ok end].
>>
>> In my opinion, in both cases the second X shouldn’t be matched against the first.
>
> Why not? Care to elaborate what is your rationale and what should happen in these cases?
>
> Kostis
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
More information about the erlang-bugs
mailing list