[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is too an application
Quoting "Greg Pettyjohn":
> OK, that helps, but suppose I want to do something like this:
>
>
> (define t%
> (class object%
> (public t1 t2)
> (define t1
> (lambda x
> (printf "t1 called with args: ~a~n" x)))
>
> (define t2
> (lambda x
> (printf "t2 called with args: ~a~n" x)
> (let ([y (cons 'foo x)])
> (send this t1 . y))))
> (super-instantiate ())))
>
> (define t (instantiate t% ()))
> (send t t2 'a 'b 'c 'd)
>
> How can I rewrite t2 without using the embedded let?
When designing the `.'-based send form, it seemed like a bad idea, but
I couldn't pin down why. Now I see clearly.
The problem is that
(send this t1 . (cons 'foo x))
and
(send this t1 'foo x)
are equivalent at the reader level.
Requiring the expression after `.' not to have parentheses is weird.
Looks like we need an `apply-send' form, instead.
Matthew