[plt-scheme] small API suggestion

From: Dave Herman (dherman at ccs.neu.edu)
Date: Fri Aug 15 19:30:15 EDT 2008

It's hard to test programs that use `syntax-local-introduce' without a 
predicate for checking for the current mark. Here's a simple API for 
testing for the presence of the current mark:

     ;; syntax-local-input? :: syntax -> boolean
     (define (syntax-local-input? stx)
       (bound-identifier=?
        (datum->syntax stx 'foo)
        (datum->syntax (current-transformer-input) 'foo)))

(This is assuming a built-in function

     current-transformer-input :: -> syntax

which returns the current syntax object that is the argument of the 
current transformer. Obviously this helper function wouldn't be 
necessary for a native implementation.)

The expected behavior would be that for any syntax object stx,

     (syntax-local-input? stx) => (not (syntax-local-input?
                                         (syntax-local-introduce stx)))

Does this seem like a good idea? I think it'd be useful. If nothing 
else, at least it would be helpful for understanding the behavior of 
`syntax-local-introduce'.

Thanks,
Dave


Posted on the users mailing list.