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

Re: operation->procedure



    From:    Jim Meehan <Meehan>
    
    Problem:  I have an  OBJECT-expression  with  38  method-clauses.
    
Yes, I agree this is a problem.

    Hack solution #1: create a locale and "export" it for later use by EVAL:
    
        (DEFINE (MAKE-THING X Y Z)
          (LOCALE FOO
            (LET ((A ...) (B ...) (C ...))
              ...
              (OBJECT NIL
                ((MY-ENV SELF) FOO)))))
    
        (DEFINE (OP-1 THING ...)
          (EVAL '(... A ... B ... C ...) (MY-ENV THING)))
        (DEFINE (OP-2 THING ...)
          (EVAL '(... A ... B ... C ...) (MY-ENV THING)))
        ...
    
This loses because A, B, C, are not in the environment accessed by FOO.
Besides, locales are much too inefficient at this point for this kind
of use.  Also, using EVAL is incredibly inefficient.

    Hack solution  #2:   Assuming  normal  syntax for "body," run it through
    STANDARD-COMPILER once and call it later.
    
        (LET ((BODY-1 (STANDARD-COMPILER '(... A ... B ... C ...)
                                         *THE-USER-ENV*))
             ((BODY-2 (STANDARD-COMPILER '(... A ... B ... C ...)
                                         *THE-USER-ENV*))
              ...)
         (DEFINE (OP-1 THING ...)
           (RUN-COMPILED-CODE BODY-1 (MY-ENV THING)))
         (DEFINE (OP-2 THING ...)
           (RUN-COMPILED-CODE BODY-2 (MY-ENV THING)))
         ...)
    
This loses because you're code won't compile with TC.  Also,
*THE-USER-ENV* is inappropriate as an argument to STANDARD-COMPILER,
which wants a syntax table.

    I don't  like  either of these solutions.  Do you have any better ideas?

No.  Maybe implement a more useable object system, with some facility
for incrementally redefinable methods.  People seem to expect T's
object system to do things that it wasn't intended to do.  I haven't
time now to work on this problem.  Perhaps someone else will have
some suggestions.