[erlang-questions] [semi-ot] introducing constants and include (that can include erlang code) in efene
Tue Aug 16 11:26:04 CEST 2011
On Tue, Aug 16, 2011 at 6:58 AM, Richard O'Keefe <> wrote:
> On 15/08/2011, at 2:17 AM, Mariano Guerra wrote:
>> hi, I just wanted to show you two new inclusions on efene.
> The idea of defining a "constant" using an expression that involves
> variables that are not in scope at the point of definition and then
> having them bound at the point of use is, well, that kind of horrible
> mess is why Scheme has "hygienic" macros instead of classic Lisp ones.
yes, but I don't know a way to make hygienic macros in efene without
doing some hacky thing, if someone want's to help me I would be glad
to try :)
> Look at "once" features in Eiffel for a nice model (it's just lazy
> evaluation, really).
I don't know a way to mutate the body of a function at runtime, what
can be done right now in efene is that if the expression can be
calculated at compile time, you can execute it then and just put the
result in the bytecode:
[ ~]$ cat demo.ifn
biglist = fn ()
$[1000 .. 1010]
run = fn ()
io.format("list ~p~n", [biglist()])
[ ~]$ fnc -t erl demo.ifn
[1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008,
run() -> io:format("list ~p~n", [biglist()]).
[ ~]$ fnc demo.ifn
[ ~]$ fnc -r demo run
of course this is just a small set of what "once" can do, but to
replace constants in some cases it's enough
More information about the erlang-questions