[erlang-questions] newbie LFE question

Robert Virding rvirding@REDACTED
Sat Dec 13 05:41:41 CET 2008

When you compile a file in the shell you are actually doing two separate
operations: compile the source file to a beam file, and then load the beam
file into the system. The erlang shell built-in function c(ModName) does
these operations using the vanilla erlang compiler. There is no such special
support in the erlang shell for LFE.

This means that you have to explicitly do the two separate steps. First
compile the LFE file using lfe_comp:file/1 and then load in the beam file
using the shell built-in function l(ModName). So for test.lfe you would do:

21> lfe_comp:file("test.lfe").
22> l(test).

The lfe compiler understands if you give the file without the .lfe extension
so you can write lfe_comp:file(test).

In the LFE shell the builtin shell function (c 'test) compiles and loads an
LFE file. To compile vanilla erlang files there is the builtin shell
function (ec 'test).

Please let me know how you get on with LFE.


2008/12/13 Raoul Duke <raould@REDACTED>

> hello,
> i'm seeking help understanding how to use lfe_comp in the shell.
> apologies for my cluelessness. when using the erl shell, it seems to
> let me redefine (replace) a function by recompiling the file. however,
> lfe_comp:file/1 doesn't seem to do that; the function is, as far as i
> can tell, retaining its old behaviour. (also, if i have test.lfe with
> foo/1 and test.erl with foo/1 then lfe_comp:file(test) won't result in
> foo/1 being from test.lfe, but will still be from test.erl.)
> thanks for any insights.
> sincerely.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081213/f9b10032/attachment.htm>

More information about the erlang-questions mailing list