Closed prez closed 4 years ago
The call to fe_nextarg
is for checking for the existence of an argument to fn
:
> (fn)
error: too few arguments
Without it the above code wouldn't cause an error and the resultant function would segfault when called.
Thanks, that makes sense now - I haven't thought of this case. And sorry for the noise.
In the
P_FN
andP_MAC
case ofeval
, we setva
to a newly allocated object containing (env . arg). Afterwards, we callfe_nextarg
, discarding the return value and advancing the arg-list, which contains the argument list of the funtion and the expression itself. But the previous value ofarg
was already baked intova
, andarg
is not used anywhere later ineval
(and is local to it).Therefore, is the
fe_nextarg
line a no-op? https://github.com/rxi/fe/blob/master/src/fe.c#L660Recompilation with the call removed does not seem to change the behaviour of function declaration.