<div>That's why it's preferable to have the convention to put the comma in the beginning om the line, like this:<br></div><div><br></div><div>[ #haha{v=1}</div><div>, #haha{v=2}</div><div>, #haha{v=3}</div><div>].</div>
<div><br></div><div>It looks kinda funky at first sight, but once you get used to it then it will make your life easier.</div><br><div class="gmail_quote">2012/4/20 JD Bothma <span dir="ltr"><<a href="mailto:jbothma@gmail.com">jbothma@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sadly erlang doesn't allow a trailing comma in the last element like<br>
<br>
[<br>
#haha{v=1},<br>
#haha{v=2},<br>
#haha{v=3},<br>
].<br>
<br>
otherwise, always trailing with a comma is a common best practise,<br>
e.g. in PHP arrays. When it becomes habit it's hardly a problem.<br>
<br>
Since this can silently cause bugs, the warning suggested in<br>
<a href="http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html" target="_blank">http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html</a> sounds<br>
like a good thing to push for, unless there's a better solution?<br>
<span class="HOEnZb"><font color="#888888"><br>
JD<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 20 April 2012 13:54, Serge Polkovnikov <<a href="mailto:serge.polkovnikov@gmail.com">serge.polkovnikov@gmail.com</a>> wrote:<br>
><br>
><br>
> 20 апреля 2012 г. 14:34 пользователь Vlad Dumitrescu <<a href="mailto:vladdu55@gmail.com">vladdu55@gmail.com</a>><br>
> написал:<br>
><br>
>> Hi Serge,<br>
>><br>
>> On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov<br>
>> <<a href="mailto:serge.polkovnikov@gmail.com">serge.polkovnikov@gmail.com</a>> wrote:<br>
>> > The compiler "eats" structures which are not separated by commas.<br>
>> > start() -><br>
>> > [<br>
>> > #haha{v=1} %% No comma here<br>
>> > #haha{v=2} %% No comma here<br>
>> > #haha{v=3}<br>
>> > ].<br>
>><br>
>> No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}.<br>
><br>
><br>
> Is there any simple way to protect such lists against the behaviour?<br>
>><br>
>><br>
>> Try the following to understand:<br>
>><br>
>> -record(haha, { a,b,c } ).<br>
>> start() -><br>
>> [<br>
>> #haha{a=1} %% No comma here<br>
>> #haha{b=2} %% No comma here<br>
>> #haha{c=3}<br>
>> ].<br>
>><br>
>> regards,<br>
>> Vlad<br>
><br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div>Håkan Nilsson</div>