[plt-scheme] Re: current-eval is now ready to receive anything...
--- "Paulo J. Matos" <pocm at soton.ac.uk> wrote:
> Sorry... pressed Send, when I should have pressed Save...
> The message continues below...
>
> On 3/5/07, Paulo J. Matos <pocm at soton.ac.uk> wrote:
> > Hi all,
> >
> > By preparing current-eval to receive more than just
> syntax-objects as
> > stated in docs (which I quoted in my last post but
> mis-interpreted)
> > can I know before hand which things may be passed to current-eval
> > besides what the user types in and their type?
> > My guess is that when the user types something it is sent in the
> form
> > of syntax object to current-eval, except the s-expr
> (current-namespace (module->namespace 'test))
>
> Up until now I was not able to find any exception to this rule.
> Is there anything more I should know?
The module-name-resolver calls the current evaluator on the compiled
code for a module the first time a module is required. And the 'eval'
procedure just passes along whatever it is given:
(define old-evaluator (current-eval))
(define (evaluator x)
(cond [(and (syntax? x) (compiled-expression? (syntax-e x)))
(display "evaluating compiled code wrapped in syntax\n")]
[(syntax? x)
(display "evaluating syntax\n")]
[(compiled-expression? x) (display "evaluating compiled
code\n")]
[else (display "evaluating S-expression\n")])
(old-evaluator x))
(begin (current-eval evaluator)
;; the module-name-resolver calls eval
;; on the contents of the .zo file
(require (lib "cmdline.ss"))
;; 'eval' just passes argument along
(void (eval '(lambda (x) x)))
(void (eval (compile '(lambda (x) x)))))
Ryan
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com