Proper behavior of slot-initforms in defstruct?

Jean-Claude Beaudoin jean.claude.beaudoin at gmail.com
Tue Aug 4 07:55:30 UTC 2015


On Mon, Aug 3, 2015 at 10:12 PM, Peter Stirling <peter at pjstirling.plus.com>
wrote:

> My read of the spec is that either behaviour is allowable.
>
>
The two behaviors are so different that I have a hard time accepting this.


>
> I guess they didn't think about people using closures for initforms when
> they were drawing it up?
>
>
Yet they clearly thought about closures when they specified DEFCLASS[3]
(see the part where
processing of :initform form is mentioned). So, was this really just simple
oversight?

To side-step the issue I would invoke a closure from the initform instead
> (if that's how you want to do it).
>
>
This is indeed probably the proper workaround that would assure portability
across CL implementation.

But I find sad that we'd have to force defstruct to be a top-level only form
with this workaround instead of letting perfectly normal language
constructs intermix
freely as the problem would find appropriate and natural.

My interest here is that I am reworking the implementation of the DEFSTRUCT
macro in MKCL.
And honestly I am of the opinion that there is a pretty strong case to be
made in favor
of the clisp behavior on this issue. But I cannot figure out the
justification for the other
behavior illustrated by almost all of the other implementations. Is this
just some long
standing historical quirk at play here or is there really a reason for this
way of doing it?


[3] http://www.lispworks.com/documentation/HyperSpec/Body/m_defcla.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20150804/53c6da28/attachment.html>


More information about the pro mailing list