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

Magnus Henoch <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
Mattias Waldau <[email protected]> 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.

Regards,
Magnus
_______________________________________________
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.