[erlang-bugs] QLC bug

Robert Virding <>
Wed Jun 22 04:17:37 CEST 2011


If you generate the expansion from the example in documentation:

qlc:q([{A,X,Z,W} ||
          A <- [a,b,c],
          {X,Z} <- [{a,1},{b,4},{c,6}],
          {W,Y} <- [{2,a},{3,b},{4,c}],
          X =:= Y]).

and then from the equivalent canonical form:

qlc:q([{A,X,Z,W} ||
          A <- [a,b,c],
          {X,Z} <- [{a,1},{b,4},{c,6}],
          {W,Y} <- [{2,a},{3,b},{4,c}],
          erlang:'=:='(X, Y)]).

you find that they are VERY different. The first one is much larger with more cases in it. I don't know if they are equivalent. Note that this is *exactly the same code* with just a different way of writing the equality test.

If they are not equivalent then it is definitely a bug as both forms are equivalent, X =:= Y is just the operator syntax for the canonical form erlang:'=:='(X, Y).

Even if they are equivalent then it is probably also as bug as there is no reason for the expansions to be different as again the code is the same.

A quick idea as to why it is like this is that the special handling of operators is done before it is converted into the canonical form.

Robert

-- 
Robert Virding, Erlang Solutions Ltd.



More information about the erlang-bugs mailing list