%is doesn't support function with keyword arguments
Example:
(define (any->moment x)
x)
(define (%earlist moment moments)
(%and (%not (%= moments '()))
(%is moment (sort moments (lambda (a b) (moment<? a b))
#:key (lambda (x) (any->moment x))))))
Would fail with variable-reference-constant?: cannot use identifier tainted by macro transformation. While:
(define (%earlist moment moments)
(%and (%not (%= moments '()))
(%is moment (sort moments (lambda (a b) (moment<? (any->moment a) (any->moment b)))))))
Works, however.
@mflatt I'm a bit lost on this. The problem appears to be monkeying with the expansion of keyword applications. I looked into it a bit and the code is old enough that you added the disarm call. I suspect that the problem is not properly rearming, but I tried a few things and they all didn't work. Can you give me some pointers?
@jeapostrophe Thanks for looking into the problem. I figured out that the problem is with this line (https://github.com/racket/racket/blob/62f5b2c4e4cdefa18fa36275074ff9fe376ddaf3/racket/collects/racket/private/kw.rkt#L1163). The syntax-protect over the macro below makes disarming somewhat hard. The racket docs stated that one can use a more powerful inspector to pass around that. However, in order to do that, we need to create the inspector in the file where we call %is, not in racklog.rkt.
I never managed to get it working, either. So I ended up with these commit (https://github.com/racket/racklog/compare/master...sorpaas:master) that suits my need.
Yes, if the way you got %is was from a #lang, then the #%module-begin could get the inspector for the %is usage, but because it's a module we can't do that.
@jeapostrophe So what's your suggested solution? Should we change the definition of %is or try other methods? I would really love to see this problem fixed in upstream.