[racket] Applying keyword arguments to (send)
Hey there, Racketeers! Hope you're having a nice thanksgiving if
you're in America.
(send) supports apply-style calling by calling it with a dotted
parameter. How can I call a method with a list of *keyword*
arguments? I essentially want to do keyword-apply but on a
method, and I don't quite have it right:
;;;;;;;;;;;;;
#lang racket
(define fish%
(class object%
(super-new)
(define/public (eat #:meal meal #:howmany howmany)
(displayln (list meal howmany)))))
(define f (new fish%))
(define args (list '#:howmany 5 '#:meal 7))
(send f eat . args)
;;;;;;;;;;;;;
This fails with:
struct eat method in fish%: expects 0 arguments plus arguments
with keywords #:howmany and #:meal, given 5: (object:fish% ...)
'#:howmany 5 '#:meal 7
Yes, it seems abusive, but is it possible?
--
Take it easy,
_mike