Open odacoder opened 9 years ago
I had thought I had replied to this but apparently I didn't.
There are a couple of issues here:
The include-lib in LFE works in exactly the same way as include_lib in Erlang: it uses the ebin ending directories in the code search path to find the directory to enter to find the file. So if you do an (include-lib "bert/include/george.lfe")
it will try to find an .../bert/ebin
directory in the path, if it finds one it will then try to find the sub-directory file bert/include/george.lfe
. It what purposely done in this way to mirror the erlang functionality. Note: it will only consider directories in the path which explicitly end in /ebin so it will ignore "."; it can handle directories in the path with a name with a version extension, so it will find bert-1.4.7/include/george.lfe
. For more info check out
If we want it to work this way is something we can discuss. Do we want slurp
in the REPL to also be code path based when trying to find a file? This discussion could be moved to the LFE mailing list
https://groups.google.com/forum/#!forum/lisp-flavoured-erlang
Robert
The latest test version of LFE in the lfe-dev branch now handles search paths properly. I will soon release this into the develop branch and then when it feels really safe into the master branch.
I've noticed this in the kanin (LFE AMQP) library. For instance:
The work-around in the REPL is to do the following:
I had thought that whether an
ebin
was present on a path in(code:get_path)
or not, includes could still be found. Perhaps I mis-read the Erlang source. Perhaps naively, I am under the current belief that the issue is due to this. When adding lib paths inERL_LIBS
and with-pa
options, anebin
is post-fixed in the code paths, and with these paths, the include is not found.For instance, the list returned when calling
(code:get_path)
doesn't have../kanin
in it; it only has../kanin/ebin
. This path is essential for compiled code -- without it, compiled code can't find the includes. In the REPL, however, this doesn't seem to help. Only when I add the path manually, without the "ebin" appeneded, do I get a successful slurp in the REPL.I'll try to hack something up in the
make
include that callslfetool with -eval "code:add_patha(\"../kanin\")."
, but Ifetool may not support that ... I may need to submit a fix that lets lfetool support this.Perhaps this is an issue with the LFE REPL? Maybe I should report an issue there, too ...