gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] defgeneric method fix


From: Camm Maguire
Subject: [Gcl-devel] defgeneric method fix
Date: 11 Jul 2003 14:20:43 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi Paul!  The patch below will get you past the 'method not working
yet' issue.  Now the tests stop with the messages below.  Insights
appreciated. 

Take care,

=============================================================================
...
Finished loading defgeneric-method-combination-max.lsp
Loading defgeneric-method-combination-min.lsp
Finished loading defgeneric-method-combination-min.lsp
Loading defgeneric-method-combination-and.lsp
Finished loading defgeneric-method-combination-and.lsp
Loading defgeneric-method-combination-or.lsp
Finished loading defgeneric-method-combination-or.lsp
Loading defgeneric-method-combination-progn.lsp
Finished loading defgeneric-method-combination-progn.lsp
Loading find-class.lsp
Finished loading find-class.lsp
Loading next-method-p.lsp
Compiling gazonk0.lsp.
End of Pass 1.  
End of Pass 2.  
OPTIMIZE levels: Safety=3, Space=0, Speed=3
Finished compiling gazonk0.lsp.
Loading gazonk0.o
start address -T 0x8b97a20 Finished loading gazonk0.o
Finished loading next-method-p.lsp
Loading call-next-method.lsp
Finished loading call-next-method.lsp
Loading compute-applicable-methods.lsp
Error in FIND-METHOD-COMBINATION [or a callee]: FIND-METHOD-COMBINATION [or a 
callee] requires more than two arguments.

Fast links are on: do (use-fast-links nil) for debugging
Broken at FIND-METHOD-COMBINATION.  Type :H for Help.
 1 (Continue) Retry loading file "compute-applicable-methods.lsp".
 2 Retry loading file "load-objects.lsp".
 3 Retry loading file "gclload2.lsp".
 4 Retry loading file "gclload.lsp".
 5 (Abort) Return to top level.
dbl:CL-TEST>>:bt

#0   FIND-METHOD-COMBINATION {loc0=#<compiled-closure 
08427310>,loc1=+,loc2=(:most-specific-first),loc3=(#<co...} [ihs=17]
#1   ENSURE-GENERIC-FUNCTION-USING-CLASS {existing=(nil cam-gf-03 :lambda-list 
...),spec=#S(pcl::method-call function #<c...} [ihs=16]
#2   LOAD-DEFGENERIC 
{function-specifier=cam-gf-03,lambda-list=(x),initargs=(:method-combination (+ 
:...} [ihs=15]
#3   (DEFGENERIC CAM-GF-03)3184 {} [ihs=14]
#4   CLCS-LOAD {} [ihs=10]
#5   CLCS-LOAD {loc0=nil,loc1=nil,loc2=nil,loc3=#<compiled-function 
conditions::clcs-load>,loc4...} [ihs=9]
#6   CLCS-LOAD {loc0=nil,loc1=nil,loc2=nil,loc3=#<compiled-function 
conditions::clcs-load>,loc4...} [ihs=8]
#7   CLCS-LOAD {loc0=nil,loc1=nil,loc2=nil,loc3=#<compiled-function 
conditions::clcs-load>,loc4...} [ihs=7]
#8   EVAL {loc0=nil,loc1=nil,loc2=nil,loc3=#<compiled-function 
conditions::clcs-load>,loc4...} [ihs=6]
#9   TOP-LEVEL 
{loc0=nil,loc1=0,loc2=0,loc3=nil,loc4=nil,loc5=nil,loc6=nil,loc7="Licensed 
under...} [ihs=5]
#10   FUNCALL {loc0=#<compiled-function system:top-level>} [ihs=4]
dbl:CL-TEST>>(macroexpand '(make-early-gf spec lambda-list lambda-list-p))

(MAKE-EARLY-GF SPEC LAMBDA-LIST LAMBDA-LIST-P)
NIL
dbl:CL-TEST>>(macroexpand '(defgeneric cam-gf-03 (x)
  (:method-combination + :most-specific-first)))

(PROGN
  (PCL::PROCLAIM-DEFGENERIC 'CAM-GF-03 '(X))
  (EVAL-WHEN (LOAD EVAL)
    (DEFUN #:|(DEFGENERIC CAM-GF-03)3184| ()
      (PCL::LOAD-DEFGENERIC 'CAM-GF-03 '(X) :METHOD-COMBINATION
          '(+ :MOST-SPECIFIC-FIRST)))
    (#:|(DEFGENERIC CAM-GF-03)3184|)))
T
dbl:CL-TEST>>(macroexpand '(PCL::LOAD-DEFGENERIC 'CAM-GF-03 '(X) 
:METHOD-COMBINATION
          '(+ :MOST-SPECIFIC-FIRST)))

(PCL::LOAD-DEFGENERIC 'CAM-GF-03 '(X) :METHOD-COMBINATION
    '(+ :MOST-SPECIFIC-FIRST))
NIL
dbl:CL-TEST>>:vs

  IHS[4]: #<compiled-function FUNCALL> ---> VS[14]
VS[14]: #<compiled-function SYSTEM:TOP-LEVEL>
  IHS[5]: #<compiled-function SYSTEM:TOP-LEVEL> ---> VS[15]
VS[15]: NIL
VS[16]: 0
VS[17]: 0
VS[18]: NIL
VS[19]: NIL
VS[20]: NIL
VS[21]: NIL
VS[22]: "Licensed under GNU Library General Public License"
VS[23]: "Dedicated to the memory of W. Schelter"
VS[24]: "Use (help) to get some basic information on how to use GCL."
VS[25]: (LOAD "gclload.lsp")
VS[26]: (LOAD "gclload.lsp")
  IHS[6]: #<compiled-function EVAL> ---> VS[27]
VS[27]: NIL
VS[28]: NIL
VS[29]: NIL
VS[30]: #<compiled-function CONDITIONS::CLCS-LOAD>
VS[31]: ("gclload.lsp")
VS[32]: NIL
VS[33]: (NIL "gclload.lsp")
VS[34]: (#<@0882DF20> NIL "gclload.lsp")
VS[35]: ((#<RESTART.0>))
VS[36]: #<compiled-function LOAD>
VS[37]: #p"gclload.lsp"
VS[38]: T
VS[39]: NIL
VS[40]: :ERROR
VS[41]: NIL
VS[42]: NIL
VS[43]: NIL
VS[44]: "lsp"
VS[45]: NIL
VS[46]: "gclload.lsp"
VS[47]: "gclload.lsp"
VS[48]: #p""
VS[49]: #<input stream "gclload.lsp">
VS[50]: NIL
VS[51]: (LOAD "gclload2.lsp")
VS[52]: #<"COMMON-LISP-USER" package>
  IHS[7]: #<compiled-function CONDITIONS::CLCS-LOAD> ---> VS[53]
VS[53]: NIL
VS[54]: NIL
VS[55]: NIL
VS[56]: #<compiled-function CONDITIONS::CLCS-LOAD>
VS[57]: ("gclload2.lsp")
VS[58]: NIL
VS[59]: (NIL "gclload2.lsp")
VS[60]: (#<@08CE0660> NIL "gclload2.lsp")
VS[61]: ((#<RESTART.1>)
         (#<RESTART.0>))
VS[62]: #<compiled-function LOAD>
VS[63]: #p"gclload2.lsp"
VS[64]: T
VS[65]: NIL
VS[66]: :ERROR
VS[67]: NIL
VS[68]: NIL
VS[69]: NIL
VS[70]: "lsp"
VS[71]: NIL
VS[72]: "gclload2.lsp"
VS[73]: "gclload2.lsp"
VS[74]: #p""
VS[75]: #<input stream "gclload2.lsp">
VS[76]: NIL
VS[77]: (LOAD "load-objects.lsp")
VS[78]: #<"COMMON-LISP-USER" package>
  IHS[8]: #<compiled-function CONDITIONS::CLCS-LOAD> ---> VS[79]
VS[79]: NIL
VS[80]: NIL
VS[81]: NIL
VS[82]: #<compiled-function CONDITIONS::CLCS-LOAD>
VS[83]: ("load-objects.lsp")
VS[84]: NIL
VS[85]: (NIL "load-objects.lsp")
VS[86]: (#<@08CE1FE0> NIL "load-objects.lsp")
VS[87]: ((#<RESTART.2>)
         (#<RESTART.1>)
         (#<RESTART.0>))
VS[88]: #<compiled-function LOAD>
VS[89]: #p"load-objects.lsp"
VS[90]: T
VS[91]: NIL
VS[92]: :ERROR
VS[93]: NIL
VS[94]: NIL
VS[95]: NIL
VS[96]: "lsp"
VS[97]: NIL
VS[98]: "load-objects.lsp"
VS[99]: "load-objects.lsp"
VS[100]: #p""
VS[101]: #<input stream "load-objects.lsp">
VS[102]: NIL
VS[103]: (LOAD "compute-applicable-methods.lsp")
VS[104]: #<"COMMON-LISP-USER" package>
  IHS[9]: #<compiled-function CONDITIONS::CLCS-LOAD> ---> VS[105]
VS[105]: NIL
VS[106]: NIL
VS[107]: NIL
VS[108]: #<compiled-function CONDITIONS::CLCS-LOAD>
VS[109]: ("compute-applicable-methods.lsp")
VS[110]: NIL
VS[111]: (NIL "compute-applicable-methods.lsp")
VS[112]: (#<@08D1D6A8> NIL "compute-applicable-methods.lsp")
VS[113]: ((#<RESTART.3>)
          (#<RESTART.2>)
          (#<RESTART.1>)
          (#<RESTART.0>))
VS[114]: #<compiled-function LOAD>
VS[115]: #p"compute-applicable-methods.lsp"
VS[116]: T
VS[117]: NIL
VS[118]: :ERROR
VS[119]: NIL
VS[120]: NIL
VS[121]: NIL
VS[122]: "lsp"
VS[123]: NIL
VS[124]: "compute-applicable-methods.lsp"
VS[125]: "compute-applicable-methods.lsp"
VS[126]: #p""
VS[127]: #<input stream "compute-applicable-methods.lsp">
VS[128]: NIL
VS[129]: (DEFGENERIC CAM-GF-03 (X)
           (:METHOD-COMBINATION + :MOST-SPECIFIC-FIRST))
VS[130]: #<"COMMON-LISP-USER" package>
  IHS[10]: #<compiled-function CONDITIONS::CLCS-LOAD> ---> VS[131]
  IHS[11]: PROGN ---> VS[131]
  IHS[12]: EVAL-WHEN ---> VS[131]
  IHS[13]: PROGN ---> VS[131]
VS[131]: NIL
VS[132]: NIL
VS[133]: NIL
VS[134]: (PROGN
           (PCL::PROCLAIM-DEFGENERIC 'CAM-GF-03 '(X))
           (EVAL-WHEN (LOAD EVAL)
             (DEFUN #:|(DEFGENERIC CAM-GF-03)3184| ()
               (PCL::LOAD-DEFGENERIC 'CAM-GF-03 '(X)
                   :METHOD-COMBINATION '(+ :MOST-SPECIFIC-FIRST)))
             (#:|(DEFGENERIC CAM-GF-03)3184|)))
VS[135]: (PROGN
           (DEFUN #:|(DEFGENERIC CAM-GF-03)3184| ()
             (PCL::LOAD-DEFGENERIC 'CAM-GF-03 '(X) :METHOD-COMBINATION
                 '(+ :MOST-SPECIFIC-FIRST)))
           (#:|(DEFGENERIC CAM-GF-03)3184|))
VS[136]: (LISP:LAMBDA-BLOCK #:|(DEFGENERIC CAM-GF-03)3184| ()
           (PCL::LOAD-DEFGENERIC 'CAM-GF-03 '(X) :METHOD-COMBINATION
               '(+ :MOST-SPECIFIC-FIRST)))
  IHS[14]: (#:|(DEFGENERIC CAM-GF-03)3184| NIL
               (PCL::LOAD-DEFGENERIC 'CAM-GF-03 '# :METHOD-COMBINATION
                   ...)) ---> VS[137]
VS[137]: NIL
VS[138]: NIL
VS[139]: ((#:|(DEFGENERIC CAM-GF-03)3184| BLOCK #<@08D1D530>))
VS[140]: ((PCL::LOAD-DEFGENERIC 'CAM-GF-03 '(X) :METHOD-COMBINATION
              '(+ :MOST-SPECIFIC-FIRST)))
VS[141]: #<compiled-function PCL::LOAD-DEFGENERIC>
  IHS[15]: #<compiled-function PCL::LOAD-DEFGENERIC> ---> VS[142]
VS[142]: CAM-GF-03
VS[143]: (X)
VS[144]: (:METHOD-COMBINATION (+ :MOST-SPECIFIC-FIRST))
VS[145]: CAM-GF-03
VS[146]: (:LAMBDA-LIST (X) :DEFINITION-SOURCE
             ((DEFGENERIC CAM-GF-03) NIL) :METHOD-COMBINATION
             (+ :MOST-SPECIFIC-FIRST))
VS[147]: NIL
VS[148]: NIL
VS[149]: #<compiled-closure ENSURE-GENERIC-FUNCTION-USING-CLASS>
  IHS[16]: #<compiled-closure ENSURE-GENERIC-FUNCTION-USING-CLASS> ---> VS[150]
VS[150]: (NIL CAM-GF-03 :LAMBDA-LIST (X) :DEFINITION-SOURCE
              ((DEFGENERIC CAM-GF-03) NIL) :METHOD-COMBINATION
              (+ :MOST-SPECIFIC-FIRST))
VS[151]: #S(PCL::METHOD-CALL FUNCTION
               #<compiled-closure PCL::|(CALL 
REAL-ENSURE-GF-USING-CLASS--NULL)|>
               PCL::CALL-METHOD-ARGS (NIL))
VS[152]: (NIL CAM-GF-03 :LAMBDA-LIST (X) :DEFINITION-SOURCE
              ((DEFGENERIC CAM-GF-03) NIL) :METHOD-COMBINATION
              (+ :MOST-SPECIFIC-FIRST))
VS[153]: #<compiled-closure PCL::|(CALL REAL-ENSURE-GF-USING-CLASS--NULL)|>
VS[154]: (NIL CAM-GF-03 :LAMBDA-LIST (X) :DEFINITION-SOURCE
              ((DEFGENERIC CAM-GF-03) NIL) :METHOD-COMBINATION
              (+ :MOST-SPECIFIC-FIRST))
VS[155]: NIL
VS[156]: #<compiled-function PCL::REAL-ENSURE-GF-USING-CLASS--NULL>
VS[157]: NIL
VS[158]: CAM-GF-03
VS[159]: :LAMBDA-LIST
VS[160]: (X)
VS[161]: :DEFINITION-SOURCE
VS[162]: ((DEFGENERIC CAM-GF-03) NIL)
VS[163]: :METHOD-COMBINATION
VS[164]: (+ :MOST-SPECIFIC-FIRST)
VS[165]: (+ :MOST-SPECIFIC-FIRST)
@ IHS[17]: #<compiled-closure FIND-METHOD-COMBINATION> ---> VS[166]
VS[166]: #<compiled-closure 08427310>
dbl:CL-TEST>>:loc

#<compiled-closure 08427310>
dbl:CL-TEST>>:bl
>> FIND-METHOD-COMBINATION():
Local(0): #<compiled-closure 08427310>
Local(1): +
Local(2): (MOST-SPECIFIC-FIRST)
Local(3): (#<compiled-closure 08427310> + (MOST-SPECIFIC-FIRST))
Local(4): NIL
Local(5): (#<Standard-Method FIND-METHOD-COMBINATION (GENERIC-FUNCTION
                                                      (EQL +) T) 1037532720>
            T ...)
Local(6): ( T +)
Local(7): (T +)
Local(8): (+)
Local(9): (#<compiled-closure 08427310> + (MOST-SPECIFIC-FIRST))
Local(10): NIL
NIL
=============================================================================

Index: pcl_boot.lisp
===================================================================
RCS file: /cvsroot/gcl/gcl/pcl/pcl_boot.lisp,v
retrieving revision 1.1
diff -u -r1.1 pcl_boot.lisp
--- pcl_boot.lisp       26 Feb 2003 22:21:38 -0000      1.1
+++ pcl_boot.lisp       11 Jul 2003 18:15:44 -0000
@@ -203,9 +203,13 @@
                  (duplicate-option :method-class)
                  (initarg :method-class `',(cadr option))))
            (:method
-             (error
-               "DEFGENERIC doesn't support the :METHOD option yet."))))
-
+;            (error
+;              "DEFGENERIC doesn't support the :METHOD option yet."))))
+            (push `(defmethod ,function-specifier ,@(cdr option))
+                  methods))))
+;          (t ;unsuported things must get a 'program-error
+;           (simple-program-error "Unsupported option ~S." option))))
+       
        (let ((declarations (initarg :declarations)))
          (when declarations (initarg :declarations `',declarations)))))
     `(progn

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]