[erlang-bugs] Packaged modules and qlc has namespace issues

Jay jkposti@REDACTED
Mon Mar 10 11:39:53 CET 2008


Hi there,

I have been doing some Erlang programming and everything has been fun so  
far. However, I have had this one issue for sometime now that is quite  
annoying.

Below is an example code, which describes the problem.


-module(some.db.package).

get_something() ->
	F = fun() ->
    	  	Q = .qlc:q([D ||
			D <- .ets:table(table1),
			P <- .ets:table(table2),
			D#table1.id == P#table2.id,
			D#table2.fielda == 1]),
			.qlc:e(Q)
		end,
	.mnesia:transaction(F).


Calling the above function results following error:

{aborted,
  {undef,
   [{'some.db.lists',reverse,
     [[{table1,{1,1},"row1"},
       {table1,{1,0},"row2"}]]},
    {qlc,collect,1},
    {qlc,eval,2},
    {mnesia_tm,apply_fun,3},
    {mnesia_tm,execute_transaction,5},
    {'some.db.package',get_something,0}]}}},
	...


This looks to me like a carefully placed dot in the qlc package might give  
the necessary help. Writing ".lists:reverse(A)" instead of  
"lists:reverse(A)".

The workaround to this problem is to have this function in the top level  
module.

Cheers



More information about the erlang-bugs mailing list