Closed shawnw closed 1 year ago
I confirm that this bug behaves the same on my machine.
This code:
tmp = SEXP_FALSE;
if ((i < argc) && !main_symbol)
tmp = sexp_c_string(ctx,argv[i],-1);
sexp_env_define(
ctx, sexp_meta_env(ctx),
sym=sexp_intern(ctx, sexp_raw_script_file_symbol, -1), tmp);
both defines the variable and sets the right value at once.
We probably should define it as #f
first, and set!
it later.
I can't find anything like sexp_env_set
. But reading the code of sexp_env_define
, it looks like you can call it more than once. When it meets an existing variable, it will re-use the same "location" (in RnRS parlance).
@ashinn Should we add the raw-script-file
symbol to the globals table? See sexp_init_context_globals()
in sexp.c
. That's where all the "usual suspects" are listed (current-input-port
and so on).
Demonstration:
I think it's probably because the image dump processing happens before
raw-script-file
is defined in main.c.