[erlang-bugs] Parser bug: if missing ", " in list between records, the first is ignored, and no parser warnings are given.

Roland Karlsson roland.karlsson@REDACTED
Sun Nov 9 14:02:14 CET 2014


Hi Mattias and Loïc.

That #rec{}#rec{} is correct syntax is a result of how operators work.
Making it not correct syntax needs a special treatment of this case.
Which should be weird. Even more weird if it would be correct syntax in
"advanced macros" only.

Having a warning is another issue, warnings are based on heuristics
and opinions.

 Loïc - have you seen a warning if you e.g. write A*B+C  ?
This expression (in principle) takes A*B, creating an unnamed
variable. This unnamed variable is then added with C. Have you
seen any warnings that this unnamed variable is unused?
The same goes for #rec{}#rec{}. The first #rec{} creates an
unnamed record of type rec. The second #rec{} modifies
the unnamed record. You might not like the record syntax, and find
the #rec{}#rec{} unreadable - but it is very clear what it does.
BTW - the bit syntax and list comprehensions are even more hairy.

Now, I am not a part of the OTP group or developing Erlang syntax, so
it feels a bit awkward to defend it and be forced to come with
motivations and proofs for being right.

So - this is my last post on this subject.


/Roland




On Sun, 9 Nov 2014 13:23:59 +0100
Mattias Waldau <mattias.waldau@REDACTED> wrote:

> Hi All,
> 
> I think the discussion went overboard. I made a small typo, forgetting a single comma in a static list.
> 
> I know realize that
> 
> #rec{}#rec{}
> 
> is correct syntax, and I do not understand why it should be.
> 
> Why not just say that it isn't ok? Who needs this syntax, except a advanced macro?
> 
> /mattias

-- 
Roland Karlsson <roland.karlsson@REDACTED>




More information about the erlang-bugs mailing list