[erlang-questions] Is it a compiler bug?

Minin Maxim Maxim.Minin@REDACTED
Thu Apr 13 15:27:40 CEST 2017


Hello,

i'm confused about a very simple module like this:
-----------------------------------------------------------------------
-module(sample).

-record (a, {field1}).

-export([bug/0]).

bug() ->
                [
                #a{field1 = 1} %% COMMA IS MISSING
                #a{field1 = 2},
                #a{field1 = 3}
                ].
-----------------------------------------------------------------------

Why can it be compiled?

Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.3  (abort with ^G)
1> c("sample.erl").
{ok,sample}
2> sample:bug().
[{a,2},{a,3}]

And eshell do it to:

3> rr(sample).
[a]
4> [#a{field1 = 1} #a{field1 = 2}, #a{field1 = 3}].
[#a{field1 = 2},#a{field1 = 3}]
5>

Do I understand something wrong or is it a compiler bug?

Thanks
Maxim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170413/4c452d3d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5536 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170413/4c452d3d/attachment.bin>


More information about the erlang-questions mailing list