Re: Useful code - perhaps worth modifying base distribution?

From: Moises Lejter <mlm_at_cs.brown.edu>
Date: Wed, 26 Jul 1995 04:41:14 -0400

Sorry - that last patch was for stklos.stk. ;-)

I am not entirely positive about this, but it seems to me that the
same kind of problem I just reported with #'define-class can pop up
with #'define-method. The way the code is written, the type
specializers given for the arguments to a method must be globally
known. If one were to create STklos classes local to a particular
scope, its methods would not work.

An easy way to fix this is to replace the macro #'method in stklos.stk
with this version:

(define-macro (method args . body)
  (let ((varname (gensym)))
   `(let ((,varname (build-specializers-list ,args)))
     (make <method>
           :name ,method
           :specializers ',(car ,varname)
           :procedure (lambda (next-method ,_at_(cdr ,varname))
                           ,_at_body)))))

It just moves the computation of the specializer list into the
environment where the method is being defined, rather than forcing it
to be in the global environment.

I have not tested this one at all (wrote it off the top of my head) -
I don't use local STklos classes, either - but I am sure someone will
correct me if it is wrong... ;-)

Moises
-----------------------------------------------------------------------------
Internet/CSnet: Moises_Lejter_at_brown.edu BITNET: mlm_at_browncs.BITNET
UUCP: ...!uunet!cs.brown.edu!mlm Phone: (401)863-7671
USmail: Moises Lejter, Box 1910 Brown University, Providence RI 02912
Received on Wed Jul 26 1995 - 10:44:46 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST