Jl_eval_string vs jl_load_file_string

embedding

#1

Hi,

What is the difference between the two functions? (For jl_load_file_string I am considering only the case when a string is passed, not a filename.)
As far as I could understand from the source code, jl_eval_string parse its input with jl-parse-string on the femtolisp side, and jl_load_file_string (jl_parse_eval_all in fact) uses jl-string-stream. I am not able to understand lisp source code, but from the name I would say there is no real difference. As regards evaluation of the code, both functions eventually call jl_interpret_toplevel_expr_in which in turns call eval (the C function defined in interpret.c, not the Julia one). I am not able to understand the impact of the differences in the code which is run before and after the call to eval.

Thanks,
Bruno


#2

My understanding is that jl_eval_string is equivalent to eval(parse(s)) in Julia, and only evaluates a string containing a single expression. jl_load_file_string is equivalent to include_string in Julia, and can evaluate multiple expressions (on separate lines).


#3

That is what I thought at first but I tried sending a multiline string (so with several expressions) to jl_eval_string and it worked. I asked the question because the 2 functions seem to do the same thing.