[Snow-users-list] Macros and eval (or anything else in fact)

Adrien Pierard pierarda at iro.umontreal.ca
Tue Jul 17 18:32:15 EDT 2007


Hi!

I'm writing an application relying on snow for portability and I
encountered today an issue with macros and eval.
As you may know, EVAL behaves differently on different hosts (or its
calling convention may vary).
The following line is valid Gambit, yet invalid Gauche :

(eval 42)

However,

(eval 42 (interaction-environment))

seems ok whatever host I use.
Yet, I'm wondering. Suppose I have the following code

(define-macro (foo bar)
  (eval '( ... )))

I have two choices here : either modify each call-site to use
INTERACTION-ENVIRONMENT too, either, say, write a dummy snow 
package that provides snow-eval.
I'd think of something like

(define (snow-eval expr)
  (cond-expand
    (gambit 
      (eval expr))
    (gauche
      (eval expr (interaction-environment)))
    ...))

And then replace each eval with a snow eval.
But then, it seems that snow-eval isn't exported yet at macro-expansion
time, and macro foo will complain about this.

I know that EVAL is not R4RS, and that R5RS wants it to have the second
parameter, but yet, I think it shows a something quite tricky. Could
snow'ed procedures be introduced to the macro world ?

Regards,

Adrien

-- 
"I am not a Church numeral; I am a free variable!"
(The Scheme Underground)
For every complex problem, there is a solution that is simple, neat, and wrong.


More information about the Snow-users-list mailing list