[erlang-bugs] Missing comma between maps results in merge

Björn-Egil Dahlberg egil@REDACTED
Tue Jul 1 16:42:54 CEST 2014


On 2014-07-01 16:26, Knut Nesheim wrote:
> Hi,
>
> I was recently bitten by a combination of my own mistakes and a 
> unexpected syntax with maps. I'm not sure if this is a bug or intended 
> behaviour.
>
> 1> #{foo => bar, foo => quux}.
> #{foo => quux}
> 2> #{foo => bar} #{foo => quux}.
> #{foo => quux}
>
> In the second case, two maps are merged due to missing a separating 
> comma between them. I would expect it to fail with a syntax error.

It is the same behaviour as for records:

3> rr(t).
[rec]
4> [#rec{foo=bar} #rec{foo=baz}].
[#rec{foo = baz}]

>
> Is this intended behaviour?

The similarity with records is intentional .. but I agree that this 
behaviour should be revisited. I'm not convinced of it usefulness.

Thank you for your feedback!

>
> Regards
> Knut
>
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140701/224589d3/attachment.htm>


More information about the erlang-bugs mailing list