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

defstruct bug?



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