[erlang-questions] returning bindins from file:script

Joe Armstrong erlang@REDACTED
Sat Jul 21 11:42:00 CEST 2018


I suggest you read the source of file.erl - and in particular the routine
eval_stream2/6 - this returns {ok, Val} so you loose the bindings
change this is {ok,Val,Bindings} and use these when you process the next file.

If you read the code in file.erl and look at file:eval(File)

You see that basically only three routines are involved:

erl_eval:new_bindings/0 - creates  the initial bindings
io:parse_erl_expressions/3 - parses the input data
erl_eval:exprs/2 - evaluates a sequence of parsed expressions

The module erl_eval does all the hard work for you

Cheers

/Joe

On Fri, Jul 20, 2018 at 10:25 PM, Karlo Kuna <kuna.prime@REDACTED> wrote:
> i am currently working on "file fold" module.
> files are erlang scripts (as input to file:script/2) and i want to pass
> bindings structure form one call of file:script/2 to another adding to it as
> scripts are evaluated.
>
> does anyone have elegant solution for this? or at least idea how to do it
> (except
> making alternative to file:script)
>
> thanks
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list