<div dir="ltr">Certainly most of those programs make no sense and I'd be fine with the compiler rejecting them, but if it was my compiler I wouldn't want it to crash with an internal error on non-sensical programs.<div>

<br></div><div>Here's another one for you. Sensical or not?</div><div><br></div><div><div>-module(bug5).</div><div>f(X = true) when X; X; true -> ok.</div></div><div><br></div><div><div>crash reason: {case_clause,</div>

<div>    {'EXIT',</div><div>        {function_clause,</div><div>            [{gb_trees,get_1,[{x,0},nil],[{file,"gb_trees.erl"},{line,239}]},</div><div>             {beam_bool,bopt_bool_arg,2,[{file,"beam_bool.erl"},{line,435}]},</div>

<div>             {lists,mapfoldl,3,[{file,"lists.erl"},{line,1352}]},</div><div>             {beam_bool,bopt_tree,3,[{file,"beam_bool.erl"},{line,386}]},</div><div>             {beam_bool,bopt_tree_cg,3,[{file,"beam_bool.erl"},{line,360}]},</div>

<div>             {beam_bool,bopt_block,5,[{file,"beam_bool.erl"},{line,115}]},</div><div>             {beam_bool,bopt,3,[{file,"beam_bool.erl"},{line,76}]},</div><div>             {beam_bool,function,2,[{file,"beam_bool.erl"},{line,57}]}]}}}</div>

<div><br></div><div>  in function  io_lib_pretty:cind_tag_tuple/7 (io_lib_pretty.erl, line 638)</div><div>  in call from io_lib_pretty:cind_element/7 (io_lib_pretty.erl, line 727)</div><div>  in call from io_lib_pretty:cind_list/7 (io_lib_pretty.erl, line 697)</div>

<div>  in call from io_lib_pretty:cind_element/7 (io_lib_pretty.erl, line 727)</div><div>  in call from io_lib_pretty:cind_list/7 (io_lib_pretty.erl, line 697)</div><div>  in call from io_lib_pretty:cind_element/7 (io_lib_pretty.erl, line 727)</div>

<div>  in call from io_lib_pretty:cind_list/7 (io_lib_pretty.erl, line 697)</div><div>  in call from io_lib_pretty:cind_element/7 (io_lib_pretty.erl, line 727)</div></div><div><br></div><div>/ Ulf</div><div><br></div></div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 28, 2014 at 11:36 PM, Kostis Sagonas <span dir="ltr"><<a href="mailto:kostis@cs.ntua.gr" target="_blank">kostis@cs.ntua.gr</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 02/28/2014 02:05 PM, Ulf Norell wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I ran some more quickcheck tests and found a few more bugs. These are<br>
all tested on R17-rc1:<br>
</blockquote>
<br></div>
I am obviously only speaking for myself here, but I think there is a fine line on what is "reasonable" to expect from a compiler (and thus what can be classified as a bug) and what is not.  IMO, the Erlang compiler has every right to refuse to compile code that is arguably weird, to say the least.<br>


<br>
For example, the first two programs I would not expect any sensible programmer to write, and IMO these Erlang programs should be burned in hell. (No sensible programmer would write erlang:'andalso' and I would definitely do not want to have to read code that looks like that.) If you simply change the calls from being remote calls to being operators (e.g. write "true andalso true" for the first one -- similarly for the second, although this one actually has a type error and should perhaps not be compiled anyway), the BEAM compiler happily accepts them.<div class="">

<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-module(bug1).<br>
f() when erlang:'andalso'(true, true) -><br>
   ok.<br>
<br>
-module(bug2).<br>
f(X) when erlang:'and'(bad, X) -><br>
   ok.<br>
</blockquote>
<br>
<br></div>
The third program is the only one that I would classify as a bug here.<div class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-module(bug3).<br>
f(Rec, Tag) -><br>
   erlang:is_record(Rec, Tag, 1) orelse error.<br>
</blockquote>
<br></div>
The problem exists even without the erlang: part. This should be fixed.<br>
<br>
<br>
As to this last program, IMO it's non-sensical:<div class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-module(bug4).<br>
f(_) -><br>
   (fun f/1)().<br>
</blockquote>
<br></div>
The compiler has every right to throw up upon seeing code like this. Why wouldn't it? ;)<br>
<br>
Kostis<br>
______________________________<u></u>_________________<br>
erlang-bugs mailing list<br>
<a href="mailto:erlang-bugs@erlang.org" target="_blank">erlang-bugs@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-bugs" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-bugs</a><br>
</blockquote></div><br></div>