lfe-deprecated / lfetool

DEPRECATED - See:
https://github.com/lfe-rebar3/
Other
61 stars 19 forks source link

When slurping files in the REPL, some times (include-lib ...) doesn't work #132

Open odacoder opened 9 years ago

odacoder commented 9 years ago

I've noticed this in the kanin (LFE AMQP) library. For instance:

> (slurp "src/kanin.lfe")
src/kanin.lfe:10: error expanding (include-lib "kanin/include/amqp-client.lfe")
error

The work-around in the REPL is to do the following:

> (code:add_patha "../kanin")
true
> (slurp "src/kanin.lfe")
#(ok kanin)

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 in ERL_LIBS and with -pa options, an ebin 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 calls lfetool 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 ...

rvirding commented 9 years ago

I had thought I had replied to this but apparently I didn't.

There are a couple of issues here:

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

rvirding commented 9 years ago

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.