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

Eric Pailleau eric.pailleau@REDACTED
Sun Nov 16 20:52:47 CET 2014


Two strings are concatanated.

"abc" "def".
"abcdef"

even without ++.

If you look at my second mail,
erl guess that {test, 2, 6} is a record, because a record is only a tuple.

#test is only a facility in order not to write default values in a tuple. that s all.

regards



« Envoyé depuis mon mobile » Eric

Roland Karlsson <roland.karlsson@REDACTED> a écrit :

>I do not agree. Not the slightest.
>
>The use {}{} is quite meaningless. What should it mean?
>Some kind of double tuple? What is that? It would be like writing
>two atoms or two integers after each other. Double atoms?
>Double integers? Nothing like that in the Erlang syntax.
>
>The usage #foo{}#foo{} on the other hand is totally meaningful,
>even if maybe ugly. The first creates a record and the second
>modifies it. Nothing strange at all. It is like
>TMP=#foo{}, TMP#foo{}.
>perfectly legit Erlang code.
>
>
>/Roland
>
>
>
>
>On Sun, 16 Nov 2014 19:37:19 +0100
>Kostis Sagonas <kostis@REDACTED> wrote:
>
>> On 11/16/2014 07:15 PM, PAILLEAU Eric wrote:
>> >
>> > 1>  #test{a=2}#test{a=3}.
>> > #test{a = 3,b = 6}
>> >
>> > but
>> >
>> > 2> {test, 2,6}{test, 3, 6}.
>> > * 1: syntax error before: '{'
>> >
>> > ---8<------------------------------------------------------------------
>> > 10.8  Internal Representation of Records
>> >
>> > Record expressions are translated to tuple expressions during
>> > compilation. A record defined as
>> >
>> > -record(Name, {Field1,...,FieldN}).
>> >
>> > is internally represented by the tuple
>> >
>> > {Name,Value1,...,ValueN}
>> >
>> > where each ValueI is the default value for FieldI.
>> > ---8<------------------------------------------------------------------
>> >
>> > I don't have any opinion on whether this syntax should be allowed or
>> > not, but parser should not fail on second notation in such case.
>> 
>> FWIW, I am of the same opinion here.  Currently, there is some inconsistency that should not be there.
>> 
>> Kostis
>> 
>> 
>> _______________________________________________
>> erlang-bugs mailing list
>> erlang-bugs@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-bugs
>
>-- 
>Roland Karlsson <roland.karlsson@REDACTED>
>
>_______________________________________________
>erlang-bugs mailing list
>erlang-bugs@REDACTED
>http://erlang.org/mailman/listinfo/erlang-bugs


More information about the erlang-bugs mailing list