[plt-scheme] Catch an unknown method error
On Thu, Feb 21, 2008 at 1:01 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> Your macro uses x here to bind the exception. The exp part however
> comes from your macro user (you for the moment). Just imagine, cruel
> thought, that the macro user uses the new send macro like this:
>
> (send x print)
>
> meaning exp = x. Can you guess what would happen in the world of CL?
>
I understand that but lots of macros I find online use syntax->datum
and stuff like that (I understand it's used for breaking hygiene when
one wants).
On Thu, Feb 21, 2008 at 1:43 PM, Ryan Culpepper <ryanc at ccs.neu.edu> wrote:
> Catching the exception doesn't tell you whether the immediate 'send'
> referred to a non-existing method or if the method did exist but some
> other 'send' failed during the execution of the method.
>
> Use 'method-in-interface?' and 'object-interface' instead to check the
> existence of the method before doing the call. Or use
> 'object-method-arity-includes?' again if you also want to forward on
> arity mismatch.
>
> Revised code below.
>
>
Haven't thought about that. It's a lot better ;-)
Thanks everyone. I'll be back later ;-)
F