It occurs to me that this might be a better question for racket-dev, so I'm forwarding it here.
Thanks, Scott ---------- Forwarded message ---------- From: Scott Moore <[email protected]> Date: Fri, Mar 6, 2015 at 8:04 PM Subject: Unexpected results with impersonators and make-keyword-procedure To: Racket Users <[email protected]> Hi, I've run into some strange behavior with the interaction between impersonators and make-keyword-procedure. I expect that when not invoked with keywords, the result of make-keyword-procedure and a lambda with the same form should be equivalent. Instead, they behave differently when impersonated. I have included a small module that demonstrates the issue below. I expect that the two checks at the bottom should succeed. Thanks, Scott #lang racket (require rackunit) (define-values (prop:my-prop my-prop? my-prop-accessor) (make-impersonator-property 'my-prop)) (define (mark-with-my-prop val) (impersonate-procedure val #f prop:my-prop #t)) (define (mark-fun-mkp f) (mark-with-my-prop (make-keyword-procedure (λ (kwds kwd-args . other-args) (keyword-apply f kwds kwd-args other-args)) (λ args (apply f args))))) (define (mark-fun-lambda f) (mark-with-my-prop (λ args (apply f args)))) (define (dummy-impersonator val) (make-keyword-procedure (λ (kwds kwd-args . other-args) (apply values kwd-args other-args)) (λ args (apply values args)))) (define marked-mkp (mark-fun-mkp display)) (define marked-lambda (mark-fun-lambda display)) (check-eq? (my-prop? marked-lambda) (my-prop? marked-mkp)) (check-eq? (my-prop? (impersonate-procedure marked-lambda (dummy-impersonator marked-lambda))) (my-prop? (impersonate-procedure marked-mkp (dummy-impersonator marked-mkp)))) -- You received this message because you are subscribed to the Google Groups "Racket Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/CANCm3%2BKhnzk_TkhHvD7xX-u%2BitfCJ7qbRVteskevrSg3-f2jUQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
