[Larceny-users] Behavior of eval in ERR5RS

Ryan Newton rrnewton at gmail.com
Sun Dec 30 10:56:39 EST 2007


My unit testing system is based on running eval to evaluate tests.   
The old larceny eval has the default behavior of inheriting the  
interaction environment, which is what I need.  For example:

[newton at chastity ~/wavescript/src]  $ larceny
Larceny v0.96 "Fluoridation" (Dec 23 2007 08:04:15,  
precise:Linux:unified)
larceny.heap, built on Sun Dec 23 08:15:16 EST 2007

 > (eval 'x)

Error: Undefined global variable "x".
Entering debugger; type "?" for help.
debug> #<EOF>

 > (define x 99)

 > (eval 'x)
99

 >


----------------------------------------------------------------
However, under ERR5RS, no such luck:

[newton at chastity ~/wavescript/src]  $ larceny -err5rs
Larceny v0.96 "Fluoridation" (Dec 23 2007 08:04:15,  
precise:Linux:unified)
larceny.heap, built on Sun Dec 23 08:15:16 EST 2007
ERR5RS mode (no libraries have been imported)

 > (import (rnrs base) (primitives eval))

 > (eval 'x)

Error: Undefined global variable "x".
Entering debugger; type "?" for help.
debug> #<EOF>

 > (define x 99)

 > (eval 'x)

Error: Undefined global variable "x".
Entering debugger; type "?" for help.
debug> #<EOF>
-----------------------------------------------------------------

Now, this is probably the intended behavior.  The R6RS eval requires  
an explicit environment for evaluation.  But I thought by doing import  
(primitives ...) I was getting access to the old larceny eval, with  
the "dirty" behavior that it inherits the top-level environment.

By the way, I feel that the R6RS eval would be much easier to satisfy  
if the language had (all-from ...) as an export spec.  That is, if I  
could easily *aggregrate* libraries together, then I would be happier  
coming up with an environment to satisfy every call to eval.

-Ryan





More information about the Larceny-users mailing list