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

Loïc Hoguin <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Organization Nine Nines
Message-ID <[email protected]>
There are already warnings on otherwise correct syntax. Syntax being 
correct is why they are warnings and not errors. +warn_export_vars and 
+warn_shadow_vars are the most obvious examples.

I also want to note in addition to everything I mentioned that if such a 
warning is introduced, it needs to apply to both records and maps, as 
they both suffer from the same syntactic fragility.

On 11/09/2014 03:02 PM, Roland Karlsson wrote:
> 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 <[email protected]> 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
>

-- 
Loïc Hoguin
http://ninenines.eu
_______________________________________________
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.