On Wed, Dec 04, 2002 at 08:59:13PM +0100, Eric Marsden wrote:
> 
> >>>>> "mr" == Matthias Rinck <[EMAIL PROTECTED]> writes:
> 
>   mr> Structure for accessor FOO-ONE is not a FOO:
> 
>   mr> What do you think about this?
> 
> indeed, this seems to be a bug in CMUCL. I haven't figured out how to
> fix it, but the problem seems to come from the behaviour of
> structure-constructors depending on whether they are executed at the
> toplevel or not: newly created instances don't have the right layout
> when the DEFSTRUCT form isn't at the toplevel. There are probably some
> EVAL-WHENs missing in the defstruct code.

I suspect that some of this comes from the special (IR1) treatment of
%COMPILER-DEFSTRUCT... consider an example of the form

(defun foo (x)
  (if x
      (defstruct foo bar)
      (defstruct foo bar baz)))

compiling FOO causes _both_ halves of the branch to define layouts _at
compile time_, because of the IR1 treatment of defstruct (see
ir1tran.lisp); these compile-time definitions then persist until
runtime, so that a further (defstruct foo bar baz quux), even without
_executing_ the function FOO, causes yet another error.

Cheers,

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)

Reply via email to