[EMAIL PROTECTED] said:
> There's a problem when i define a class with name "method" in a new
> package.
>
> * (defpackage toto)
> #<The TOTO package, 0/9 internal, 0/2 external>
>
> * (in-package toto)
> #<The TOTO package, 1/9 internal, 0/2 external>
>
> * *package*
> #<The TOTO package, 1/9 internal, 0/2 external>
>
> * (defclass titi () ()) ; it's ok
> #<STANDARD-CLASS TITI {48137BCD}>
>
> * (defclass method () ()) ; it's no more ok ?
> ; [GC threshold exceeded with 12,012,056 bytes in use. Commencing GC.]
> ; [GC completed with 10,818,280 bytes retained and 1,193,776 bytes freed.]
> ; [GC will next occur when at least 22,818,280 bytes are in use.]
[snip more GCs]
>
> and then it crashes !
If you don't specify a :USE clause, CMUCL's DEFPACKAGE :USEs the
COMMON-LISP package, which includes a METHOD class already. So you're
trying to redefine a system class, the consequences of which are probably
undefined, or worse yet defined to be bad. If you want to define a class
called METHOD in your package, you have to say something more like
(defpackage "TOTO"
(:shadow "METHOD"))
; ...
which means that any unqualifed METHOD that you use will be TOTO::METHOD,
and also that if you want to use the system METHOD class, you have to say
CL:METHOD.
Example:
* (defpackage "TOTO" (:shadow "METHOD"))
#<The TOTO package, 1/9 internal, 0/2 external>
* (in-package "TOTO")
#<The TOTO package, 1/9 internal, 0/2 external>
* *package*
#<The TOTO package, 1/9 internal, 0/2 external>
* (defclass method () ())
#<STANDARD-CLASS METHOD {480C6AE5}>
* (find-class 'method)
#<STANDARD-CLASS METHOD {480C6AE5}>
* (in-package "CL")
#<The COMMON-LISP package, 1677/2369 internal, 978/1227 external>
* (find-class 'method)
#<STANDARD-CLASS METHOD {28150F3D}>
* (find-class 'toto::method)
#<STANDARD-CLASS TOTO::METHOD {480C6AE5}>
Hope this helps.
-- Larry