[plt-scheme] current-eval proc should receive syntax object, but doesn't

From: Ryan Culpepper (ryan_sml at yahoo.com)
Date: Sat Mar 3 21:30:47 EST 2007

--- "Paulo J. Matos" <pocm at soton.ac.uk> wrote:

> Hello all,
> I'm working on DrScheme 369.8-svn28feb2007 (which is pretty
> recent). I wonder if this is a bug, and if yes if it has been
> fixed already or if it is just me doesn't what I'm not
> supposed to.
> (module test mzscheme
>   (define myeval
>     (lambda (datum)
>       "buu"))
>   (current-eval (lambda (x) (myeval (syntax-object->datum x))))
>   )
> I get:
> syntax-object->datum: expects argument of type <syntax>; given
> (current-namespace (module->namespace 'test))
> Since docs say:
> (current-eval [proc]) gets or sets a procedure that takes an
> expression -- in the form of syntax object, S-expression, compiled
> expression, or compiled expression wrapped in a syntax object --
> and returns the expression's value (or values; see section 2.2).
> I guess that applying syntax-object->datum to x would always work.

No. You can only apply 'syntax-object->datum' to a syntax object, not
to an S-expression, nor to a compiled code object. You're violating
the (unchecked) contract of 'current-eval' by passing it a function
that can only handle syntax objects.

On the other hand, DrScheme isn't completely blameless. The reason
you're getting that particular error is that DrScheme calls the
current evaluator to do the module-language magic after the
evaluation of your module. Arguably, DrScheme should use the original
evaluator (and namespace) for that purpose to avoid interference with
the user program.


> -- 
> Paulo Jorge Matos - pocm at soton.ac.uk
> http://www.personal.soton.ac.uk/pocm
> PhD Student @ ECS
> University of Southampton, UK
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.

Posted on the users mailing list.