Re: Parser bug: if missing ", " in list between records, the first is ignored, and no parser warnings are given.

Tuncer Ayaz <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAOvwQ4hf_Ve8SDycwmXr+oGtV4cMcwgQdC35AXC7nKz0akuR8A@mail.gmail.com>
On Mon, Nov 10, 2014 at 12:31 PM, Magnus Henoch wrote:
> Mattias Waldau writes:
>
> > Thank you Loic and Roland for the explanations, I really
> > appreciate it.
> >
> > The trick to understand why this is and should be ok is that #{}
> > is n operator and then it makes sense. Then, there is another
> > question why #{} is an operator.
> >
> > This is what the Erlang reference manual says about record
> > creation, it doesn't mention #rec{}#rec{}
> >
> > So, until you explained, I just thought is was a parser bug.
>
> This syntax used to be disallowed. The "Nested records" section of
> the Records chapter of the reference manual mentions a new feature
> in R14:
>
>     Before R14 you would have needed to use parentheses as following:
>
>     "nested0" = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0.name,
>     N0n = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0{name = "nested0a"},
>
>
>     Since R14 you can also write:
>
>     "nested0" = N2#nrec2.nrec1#nrec1.nrec0#nrec0.name,
>     N0n = N2#nrec2.nrec1#nrec1.nrec0#nrec0{name = "nested0a"},
>
> As an unintended(?) consequence, this also made the #rec{}#rec{}
> syntax valid.

When I forward-ported and submitted the old patch and it was included
in R14, unfortunately both the OTP board and I failed to see that
particular problem. After R14 was released and users hit that issue,
Robert Virding and I discussed this in detail and we suggested to back
out that change. However, so far there has been no response from the
OTP team. So, personally, like Robert, I still think we should revert
the change, as the gain is not worth it given that users accidentally
write such code.
_______________________________________________
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.