Re: Missing comma between maps results in merge

Björn-Egil Dahlberg <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
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
> [email protected]
> http://erlang.org/mailman/listinfo/erlang-bugs

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.