[Openmcl-devel] DEFSTRUCT and :INCLUDE
rpgoldman at sift.info
Wed Oct 14 17:21:31 UTC 2009
Alexander Repenning wrote:
> just curious, why even still use defstruct and not just CLOS. If one
> does not need byte aligned data for low level data structures or to
> squeeze out the last nano second for accessor is there some compelling
> reason to even keep using CL structs?
> I usually advise students to ignore structs because they are mostly
One handy things about structures is that they have a predefined
readable form. This makes it easy to use structures in test
definitions, because they can easily be written into source files.
E.g., without a lot of trouble I can evaluate a form in the REPL that
yields a structure, inspect the value for correctness, and if it's
correct I can trivially paste it into a file of unit tests.
Of course one can do the same with CLOS objects with some more work, but
this is pretty handy, IMO.
Also, of course, there are those cases where I need to do stuff that
will be very efficient.
Note that neither of these cases is necessarily one you would wish to
expose to students.
More information about the Openmcl-devel