[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: specializing functions in MCL 2.0 (fwd)

>Date: Fri, 21 Aug 92 16:46:57 EDT
>From: staley@carnap.srl.ford.com (Scott M. Staley)
>Message-Id: <9208212046.AA03779@carnap.srl.ford.com>
>To: info-mcl-request@cambridge.apple.com
>Subject: specializing functions in MCL 2.0
>Can someone tell me what I am doing wrong here.
>I tried the following in MCL 2.0
>(defmethod + ((x string) (y string))
>  (concatenate 'string x y))
>first it aborts, and says + is not a gf (of course), but then
>give a restart to make it a gf and go on (I assumed).
>When I select the restart to make + a gf the machine go into the
>weeds and never returns. It seems to be doing something, but I
>have no idea what, and I can not abort it.

The restart does exactly what it says it does: it replaces the
regular function with a generic function. What it doesn't say is
that this generic function contains only the newly defined method.
There is no DWIM to make a method out of the original function
(in this case it could not do that anyway since the #'+ function
takes a rest arg and your method takes 2 required args).

MCL has a bug that it should have CERROR'ed again telling you that
you were attempting to redefine a kernel function. Instead, it just
redefined it, making the callers of #'+ in the MCL window system
fail miserably (the error mode makes it look to me that the process
of signalling the error causes another error before it manages to
print anything).

I can send a patch that will warn about the kernel function redefinition
if you want. Ask for "generic-plus-patch". This patch will be part of
patch 2 for MCL 2.0 final (patch 1 will be available soon).