[erlang-questions] What's going on here? (a function with bizarre behavior in Eshell.)

Julian Fondren ayrnieu@REDACTED
Wed Apr 18 20:41:52 CEST 2007


$ erl
Erlang (BEAM) emulator version 5.5.4 [source] [kernel-poll:false]

Eshell V5.5.4  (abort with ^G)
1> hello.
hello
2> v(-1).
hello
3> io:fwrite("~p", [v(-1)]).
hellook
4> io:fwrite("~p", [v(-1)]).
okok
5> Last = fun () -> io:fwrite("~p", [v(-1)]) end.
#Fun<erl_eval.20.112921583>
6> Last().
okok
7> f(Last), Last = fun () -> X = v(-1), io:fwrite("~p", [X]) end.
#Fun<erl_eval.20.112921583>
8> Last().
okok
9> 1.
1
10> Last().
okok
11> f(Last), Last = fun () -> X = v(-1), io:fwrite("~p", [X]) end.
#Fun<erl_eval.20.112921583>
12> f(Last), Last = fun () -> X = v(-1), io:fwrite("~p", [X]) end.
#Fun<erl_eval.20.112921583>
13> Last().
#Fun<erl_eval.20.112921583>ok
14> 1.
1
15> Last().
#Fun<erl_eval.20.112921583>ok

...

Right now, I blame shell:local_func_handler/7 or shell:local_allowed/6 ,
but I still have no clue what actually implements v/1


Cheers,
Julian



More information about the erlang-questions mailing list