2012-02-25 21:05:35 |
Alex Plotnick |
description |
Somewhere along the way, structure classes (or their layouts) are being conflated with their names. This becomes evident if you alias a structure class and then remove that alias. This doesn't happen with classes defined with DEFCLASS.
E.g.: given a file "struct-bug.lisp" containg the following forms:
(defstruct record)
(setf (find-class 'alias) (find-class 'record))
(setf (find-class 'alias) nil)
% sbcl
This is SBCL 1.0.55.1-6548750, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (load (compile-file "struct-bug" :verbose nil :print nil))
T
* (compile-file "struct-bug" :verbose nil :print nil)
; file: /home/alex/build/sbcl/struct-bug.lisp
; in: DEFSTRUCT RECORD
; (DEFSTRUCT RECORD)
; --> PROGN DEFUN PROGN EVAL-WHEN
; ==>
; (SB-IMPL::%DEFUN 'MAKE-RECORD
; (SB-INT:NAMED-LAMBDA MAKE-RECORD
; (&KEY)
; (BLOCK MAKE-RECORD
; (SB-KERNEL::%MAKE-STRUCTURE-INSTANCE-MACRO
; #<SB-KERNEL:DEFSTRUCT-DESCRIPTION RECORD> 'NIL)))
; NIL 'NIL (SB-C:SOURCE-LOCATION))
;
; caught ERROR:
; dumping anonymous layout: #<SB-KERNEL:LAYOUT for #<SB-KERNEL:STRUCTURE-CLASSOID anonymous {1004487763}> {10044877E3}>
;
; compilation unit finished
; caught 1 ERROR condition
#P"/home/alex/build/sbcl/struct-bug.fasl"
T
T
* (load *)
debugger invoked on a SB-INT:COMPILED-PROGRAM-ERROR:
Execution of a form compiled with errors.
Form:
(%DEFUN 'MAKE-RECORD
(NAMED-LAMBDA MAKE-RECORD
(&KEY)
(BLOCK MAKE-RECORD
(%MAKE-STRUCTURE-INSTANCE-MACRO #<DEFSTRUCT-DESCRIPTION RECORD>
'NIL)))
NIL 'NIL (SOURCE-LOCATION))
Compile-time error:
dumping anonymous layout: #<SB-KERNEL:LAYOUT for #<SB-KERNEL:STRUCTURE-CLASSOID anonymous {1004487763}> {10044877E3}>
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-FASL::LOAD-FASL-GROUP
#<SB-SYS:FD-STREAM for "file /home/alex/build/sbcl/struct-bug.fasl"
{1004628E93}>)
0] |
Somewhere along the way, structure classes (or their layouts) are being conflated with their names. This becomes evident if you alias a structure class and then remove that alias. This doesn't happen with classes defined with DEFCLASS, although there is some related funniness I'm still trying to track down in that case.
E.g.: given a file "struct-bug.lisp" containg the following forms:
(defstruct record)
(setf (find-class 'alias) (find-class 'record))
(setf (find-class 'alias) nil)
% sbcl
This is SBCL 1.0.55.1-6548750, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (load (compile-file "struct-bug" :verbose nil :print nil))
T
* (compile-file "struct-bug" :verbose nil :print nil)
; file: /home/alex/build/sbcl/struct-bug.lisp
; in: DEFSTRUCT RECORD
; (DEFSTRUCT RECORD)
; --> PROGN DEFUN PROGN EVAL-WHEN
; ==>
; (SB-IMPL::%DEFUN 'MAKE-RECORD
; (SB-INT:NAMED-LAMBDA MAKE-RECORD
; (&KEY)
; (BLOCK MAKE-RECORD
; (SB-KERNEL::%MAKE-STRUCTURE-INSTANCE-MACRO
; #<SB-KERNEL:DEFSTRUCT-DESCRIPTION RECORD> 'NIL)))
; NIL 'NIL (SB-C:SOURCE-LOCATION))
;
; caught ERROR:
; dumping anonymous layout: #<SB-KERNEL:LAYOUT for #<SB-KERNEL:STRUCTURE-CLASSOID anonymous {1004487763}> {10044877E3}>
;
; compilation unit finished
; caught 1 ERROR condition
#P"/home/alex/build/sbcl/struct-bug.fasl"
T
T
* (load *)
debugger invoked on a SB-INT:COMPILED-PROGRAM-ERROR:
Execution of a form compiled with errors.
Form:
(%DEFUN 'MAKE-RECORD
(NAMED-LAMBDA MAKE-RECORD
(&KEY)
(BLOCK MAKE-RECORD
(%MAKE-STRUCTURE-INSTANCE-MACRO #<DEFSTRUCT-DESCRIPTION RECORD>
'NIL)))
NIL 'NIL (SOURCE-LOCATION))
Compile-time error:
dumping anonymous layout: #<SB-KERNEL:LAYOUT for #<SB-KERNEL:STRUCTURE-CLASSOID anonymous {1004487763}> {10044877E3}>
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-FASL::LOAD-FASL-GROUP
#<SB-SYS:FD-STREAM for "file /home/alex/build/sbcl/struct-bug.fasl"
{1004628E93}>)
0] |
|