Re: Scheme bug in internal define
Jim Blandy writes:
> The Guile behavior you've demonstrated is bizarre. I don't
> particularly wish to support that code, but I agree that the system
> should complain, rather than doing something incomprehensible.
This behavior in Guile is definitely inherited from SCM. Internal
DEFINE destructively modifies the current environment, enlarging the top
environment frame. This renders any ILOCS already pointing into that
frame incorrect. The destructive modification is used so that any
closures bound by DEFINE get environments including bindings made by
later DEFINEs.
Adding new bindings to the end of the frame instead of the beginning
would run into problems with "rest" lists.
Adding code to the interpreter to specially treat internal DEFINES (eg
to actually generate an equivalent LETREC) would require large changes
to the evaluator. All the forms in a body would have to be macro
expanded completely before this could be done.
Perhaps the easiest way to catch these errors would be to allow some
extra notation to be added to an environment frame, but I'm not
clear right now on exactly how this should be done.
Received on Mon Nov 10 1997 - 06:46:28 CET
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST