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

Re: Clisp question



This might be a working solution  (ok, "hack" :)

I've put this in my init file and it works fine...

#+clisp
(eval-when (load eval)
  (unless (fboundp 'clos::%defclass)
    (setf (symbol-function 'clos::%defclass) (symbol-function 'clos::defclass))
    (defmacro clos::defclass (&rest args)
      `(progn
	 (setf (get (first ',args) 'clos::class) nil)
	 (clos::%defclass ,@args)))))

> (defclass foo () ())
#<STANDARD-CLASS FOO>
> (defclass foo () ((x)))
#<STANDARD-CLASS FOO>
> (defclass foo () ((x) (y)))
#<STANDARD-CLASS FOO>
>


So far i haven't encountered any problems.  However, Im not sure
whether it might be harmful...
The only downside seems to be that it triggers a continuable error
because clos:defclass is a clisp kernel macro.  It would be nice
to get around it somehow...