[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [plt-scheme] assertions and the learning of macro-fu



Quoth Matthew Flatt:
> At Sun, 12 May 2002 22:37:50 -0400, Don Blaheta wrote:
> > (define-syntax (assert stx)
> >     [...]
> >     (syntax-case stx (assert not)
> >       [(assert not x) (handle-assert stx #f (syntax (assert x)))]
> >       [(assert x)     (handle-assert stx #t (syntax (assert x)))])))
> >
> > [...]
> >
> > Ok, now here's the weird thing that's got me completely stumped.  If you
> > paste this into a mzscheme session directly, it works fine.  If you load
> > it into mzscheme, it works fine.  If you put this into a module, and you
> > require it from the interpreter prompt, then positive assertions (e.g.
> > (assert 3)) work fine, but negative assertions give a syntax error:
> 
> Thie difference is the binding of `not':

This is wacky, but I get it now (for those following along at home, R5RS
section 4.3.2, especially the end, is relevant and helpful).

> Another solution would be to compare `not's symbolically, ignoring
> lexical bindings. That might be appropriate in this case, because `not'
> isn't in an expression position (unlike `else' in `cond').

I still don't understand this, though.  What do you mean by "expression
position" here?

-- 
-=-Don Blaheta-=-=-dpb@cs.brown.edu-=-=-<http://www.cs.brown.edu/~dpb/>-=-
"You can certainly ask yourself "How are we different than the Nazis" and 
come up with plenty of good answers.  But when I start asking, "How are we 
the same as the Nazis", the answers begin to chill the blood.  We may not 
be genocidal, but we're doing plenty of harm, and our nazionaler rhetoric 
is doing a great job of hiding our misdeeds from most Americans."
						--Jonathan Prykop