1
作品Erlang:qlc:info會拋出一個錯誤,而qlc:eval不會 - 爲什麼?
[email protected] # erl
Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]
Eshell V5.8.3 (abort with ^G)
1> Tmp = ets:new(test, [bag]), Ref = make_ref(),
1> qlc:eval(qlc:q([Ref1 || Ref1 <- ets:table(Tmp), Ref =:= Ref1])).
[]
2> qlc:info(qlc:q([Ref1 || Ref1 <- ets:table(Tmp), Ref =:= Ref1])).
"ets:table(16400,\n [{traverse,\n {select,\n [{'$1',\n [{'=:=',{const,#Ref<0.0.0.29>},'$1'}],\n ['$1']}]}}])"
3> halt().
不工作
[email protected] # erl
Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]
Eshell V5.8.3 (abort with ^G)
1> Tmp = ets:new(test, [bag]), Ref = make_ref(),
1> qlc:eval(qlc:q([Ref1 || {Ref1} <- ets:table(Tmp), Ref =:= Ref1])).
[]
2> qlc:info(qlc:q([Ref1 || {Ref1} <- ets:table(Tmp), Ref =:= Ref1])).
** exception error: no match of right hand side value {error,{1,erl_parse,["syntax error before: ",["Ref"]]}}
in function qlc:abstract/3
in call from qlc:abstract/3
in call from qlc:abstract/4
in call from qlc:info/2
3> halt().
我不明白爲什麼。在一個更復雜的查詢中發現了這個錯誤,因爲這個錯誤,我無法解釋和配置文件。
有趣的是,如果你調用它兩次,qlc:info/1成功。 – 2011-04-15 10:13:11
你可以發佈PoC嗎?我不確定我瞭解你的意思。 – trytrytry 2011-04-23 11:53:44
這是一個古老的問題,我很驚訝它還沒有回答或關閉。我的問題是,爲什麼你將表中的引用存儲爲{Ref}而不是Ref? – pedromanoel 2012-06-13 14:14:21