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

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

Sorry to reactivate an old thread, but I just got around to trying this:

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)))])))
> >
> > [...]
> To fix the problem, change your pattern-matching rule to use
> `module-or-top-identifier=?' (from the "stx.ss" library in the "syntax"
> collection) for comparing literals:
>  (require "stx.ss" "syntax")

What is this?  It seems to try to import two different modules, one
named "stx" in the current-directory file "stx.ss", and one named
"syntax".  Neither exists in any of the mz libraries I could find....

>  (define-syntax (assert stx)
>      [...]
>      (syntax-case* stx (not) module-or-top-identifier=?
>        [(assert not x) (handle-assert stx #f (syntax (assert x)))]
>        [(assert x)     (handle-assert stx #t (syntax (assert x)))])))
> 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 what is meant by "expression position" here.

-=-Don Blaheta-=-=-dpb@cs.brown.edu-=-=-<http://www.cs.brown.edu/~dpb/>-=-
A man's home is his castle, in a manor of speaking.