bug in erl_eval

Ulf Wiger <>
Fri Jul 3 17:32:39 CEST 2009


The following shell dialogue didn't work out
as expected:

1> E = fun(N) -> if is_integer(N) -> <<N/integer>>; true -> throw(foo) 
end end.
#Fun<erl_eval.6.13229925>
2> << << (E(V))/binary >> || V <- [1,2,3] >>.
<<1,2,3>>
3> catch << << (E(V))/binary >> || V <- [1,2,3,a] >>.
{'EXIT',{{case_clause,foo},
          [{erl_eval,expr,5},
           {erl_eval,eval_bc1,6},
           {erl_eval,eval_generate,7},
           {erl_eval,eval_bc,6},
           {erl_eval,expr,5},
           {shell,exprs,6},
           {shell,eval_exprs,6},
           {shell,eval_loop,3}]}}

List comprehensions work as expected, though.

4> [ E(V) || V <- [1,2,3]].
[<<1>>,<<2>>,<<3>>]
5> catch [ E(V) || V <- [1,2,3,a]].
foo

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-bugs mailing list