[erlang-questions] code:which/1 return value
Per Hedeland
per@REDACTED
Tue Sep 25 00:30:31 CEST 2012
This is a bug, right?
Erlang R15B02 (erts-5.9.2) [source] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.2 (abort with ^G)
1> code:which(test).
"./test.beam" <<<<<<<<<<<<
2> l(test).
{module,test}
3> code:which(test).
"/home/per/erl/test.beam"
At least the documentation says "If the module is not loaded, this
function searches the code path for the first file which contains object
code for Module and returns the _absolute file name_." With the code
path cache enabled, it's "almost" right:
1> code:rehash().
ok
2> code:which(test).
"/home/per/erl/./test.beam"
(That *is* an "absolute file name", but I think it's a reasonable
expectation that it should agree with what filename:absname/1 would
produce.)
--Per Hedeland
More information about the erlang-questions
mailing list