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

redefining VIEW crashes MCL



>The following definition in MCL crashes my IIci.  Am I doing something wrong?
>
>(defclass view ()
>  ((scene :initform nil :initarg :scene :accessor view-scene)
>   (camera :initform nil :initarg :camera :accessor view-camera)
>   (lighting :initform nil :initarg :lighting :accessor view-lighting)))
>
>Thanks.  
>
>Vadim Shapiro
>GM Research 


The problem is that VIEW is used to implement the window system, so if you 
redefine it, you're asking for big trouble. 

? (defclass view ()
  ((scene :initform nil :initarg :scene :accessor view-scene)
   (camera :initform nil :initarg :camera :accessor view-camera)
   (lighting :initform nil :initarg :lighting :accessor view-lighting)))
> Error: #<STANDARD-CLASS VIEW> is already defined in the CCL kernel.
> While executing: CCL::SET-FIND-CLASS
> Type Command-/ to continue, Command-. to abort.
> If continued: Redefine #<STANDARD-CLASS VIEW>.
See the Restarts  menu item for further choices.
1 > 

Your options are to use a different name, or use a different package that
does not inherit from the CCL package. For example...


? (defpackage eye (:use common-lisp))
#<Package "EYE">
? (in-package eye)
#<Package "EYE">
? (defclass view ()
  ((scene :initform nil :initarg :scene :accessor view-scene)
   (camera :initform nil :initarg :camera :accessor view-camera)
   (lighting :initform nil :initarg :lighting :accessor view-lighting)))
#<STANDARD-CLASS VIEW>
? 

Be warned, however, that at some point down the road, you may get
a name conflict between your VIEW (known as EYE:VIEW) and MCL's VIEW
(known as CCL:VIEW). This can happen if you want to do something like 
export EYE:VIEW into a package like CL-USER, which already has CCL:VIEW.

So the safest thing in the long run is probably to pick a different name.