[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
defstruct bug?
- To: comp-lang-lisp-mcl@services.cambridge.apple.com
- Subject: defstruct bug?
- From: alanr@eliza.media-lab.media.mit.edu (Alan Ruttenberg)
- Date: Fri, 15 Jul 1994 00:33:00 GMT
- Distribution: comp
- Newsgroups: comp.lang.lisp.mcl
- Organization: MIT Media Laboratory Learning an Common Sense Group
- Sender: news@dizzy.media.mit.edu (USENET News System)
In a nutshell, definition of a boa-constructor causes structure
reading to not work.
? (defstruct (foo (:constructor a-foo (a b)))
a
b)
foo
? (read-from-string (prin1-to-string (a-foo "fiddle" "fot")))
> Error: Can't initialize structure from (foo :a "fiddle" :b "fot").
> While executing: |#S-reader|
> Type Command-. to abort.
See the Restarts menu item for further choices.
1 >
Aborted
But this looks fine:
? (prin1-to-string (a-foo "fiddle" "fot"))
"#S(foo :a \"fiddle\" :b \"fot\")"
?
The *only* thing that seems to work-around it is:
> (defstruct (foo (:constructor a-foo (a b)) (:constructor make-foo))
a
b)
In other words, a simple out of line definition of make-foo will not
fix the problem.
-alan