Re: MAKE-INSTANCE and STRUCTURE-CLASS

"Marco Antoniotti (as marco dot antoniotti at unimib dot it)" <[email protected]> Mon, 6 Jul 2026 16:59:15 +0200
Newsgroups gmane.lisp.lispworks.general,gmane.lisp.cl-pro
Message-ID <CAG0Nw2nOm67pjk9Y2+H+sEXYEZqOnDNmuvxxT4EygvSvEGTMJg@mail.gmail.com>
--000000000000a3081a0655f28578
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Of course, of course.

And yet... why don't we have a STRUCT-FIELDS and a STRUCT-CONSTRUCTORS?
(Etc, etc etc)

My answer is "because they punted" =F0=9F=A5=B9

Cheers

Marco


On Mon, Jul 6, 2026 at 4:56=E2=80=AFPM Tim Bradshaw <[email protected]> wrote:

> On 6 Jul 2026, at 15:15, Marco Antoniotti <[email protected]>
> wrote:
> >
> > my question was about "how can you do this in the least gross way?"
>
> To which my answer is 'the only non-gross way is to not do that: use
> constructor functions passed as arguments instead'.
>
> Obviously that is not what everyone wants to do.
>
> > The question is "how"?
>
> Same answer.
>
> > And the sub question is "why the standard writers punted on this?".
> Because, IMHO, they did.
>
> I don't know.  I know why I would have.  That's because any answer I can
> think of leads you into a tangled mess.
>
> For instance here's an answer:
>
> 'There should be a method on make-instance for structure-class which call=
s
> the constructor for the class given.  There is no initialization or
> reinitialization protocol, [or may be there is?]'.
>
> OK.  My structure definition has six constructors: which should be
> called?  My other structure definition has a strictly BOA constructor: ho=
w
> does this get mapped onto make-instance's signature, if at all?  My other
> structure definition has no constructors: is this an error?
>
> Should defstruct be extended compatibly to specify which constructor is
> called, which can't be a strictly BOA constructor?  What are the
> implementors going to say when we suggest that?
>
> And on and on and more and more complicated.  And now it's 2007 and the
> spec still hasn't been published.
>
> Or just don't.  Just ship the spec as it is.
>
> And over here tfb is waving his hands and saying 'stop already, just pass
> in a constructor function'.
>
> --tim



--=20
Marco Antoniotti, Professor, Director         tel. +39 - 02 64 48 79 01
DISCo, University of Milan-Bicocca U14 2043   http://dcb.disco.unimib.it
Viale Sarca 336
I-20126 Milan (MI) ITALY

REGAINS: https://regains.disco.unimib.it/

--000000000000a3081a0655f28578
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div>Of course, of course.<br><br></div>And yet.=
.. why don&#39;t we have a STRUCT-FIELDS and a STRUCT-CONSTRUCTORS? (Etc, e=
tc etc)<br><br></div>My answer is &quot;because they punted&quot;=C2=A0=F0=
=9F=A5=B9<br><br></div><div>Cheers</div><div><br></div><div>Marco</div><div=
><br></div></div><br><div class=3D"gmail_quote gmail_quote_container"><div =
dir=3D"ltr" class=3D"gmail_attr">On Mon, Jul 6, 2026 at 4:56=E2=80=AFPM Tim=
 Bradshaw &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<b=
r></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 6 Jul 2026, at=
 15:15, Marco Antoniotti &lt;<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&gt; wrote:<br>
&gt; <br>
&gt; my question was about &quot;how can you do this in the least gross way=
?&quot;<br>
<br>
To which my answer is &#39;the only non-gross way is to not do that: use co=
nstructor functions passed as arguments instead&#39;.<br>
<br>
Obviously that is not what everyone wants to do.<br>
<br>
&gt; The question is &quot;how&quot;?<br>
<br>
Same answer.<br>
<br>
&gt; And the sub question is &quot;why the standard writers punted on this?=
&quot;.=C2=A0 Because, IMHO, they did.<br>
<br>
I don&#39;t know.=C2=A0 I know why I would have.=C2=A0 That&#39;s because a=
ny answer I can think of leads you into a tangled mess.<br>
<br>
For instance here&#39;s an answer:<br>
<br>
&#39;There should be a method on make-instance for structure-class which ca=
lls the constructor for the class given.=C2=A0 There is no initialization o=
r reinitialization protocol, [or may be there is?]&#39;.<br>
<br>
OK.=C2=A0 My structure definition has six constructors: which should be cal=
led?=C2=A0 My other structure definition has a strictly BOA constructor: ho=
w does this get mapped onto make-instance&#39;s signature, if at all?=C2=A0=
 My other structure definition has no constructors: is this an error?<br>
<br>
Should defstruct be extended compatibly to specify which constructor is cal=
led, which can&#39;t be a strictly BOA constructor?=C2=A0 What are the impl=
ementors going to say when we suggest that?<br>
<br>
And on and on and more and more complicated.=C2=A0 And now it&#39;s 2007 an=
d the spec still hasn&#39;t been published.<br>
<br>
Or just don&#39;t.=C2=A0 Just ship the spec as it is.<br>
<br>
And over here tfb is waving his hands and saying &#39;stop already, just pa=
ss in a constructor function&#39;.<br>
<br>
--tim</blockquote></div><div><br clear=3D"all"></div><br><span class=3D"gma=
il_signature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signatur=
e"><div dir=3D"ltr"><div><span style=3D"font-family:monospace">Marco Antoni=
otti, Professor, Director =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tel. +=
39 - 02 64 48 79 01<br>DISCo, University of Milan-Bicocca U14 2043=C2=A0=C2=
=A0 <a href=3D"http://dcb.disco.unimib.it" target=3D"_blank">http://dcb.dis=
co.unimib.it</a><br>Viale Sarca 336<br>I-20126 Milan (MI) ITALY<br><br></sp=
an></div><span style=3D"font-family:monospace">REGAINS: <a href=3D"https://=
regains.disco.unimib.it/" target=3D"_blank">https://regains.disco.unimib.it=
/</a><br></span></div></div>

--000000000000a3081a0655f28578--

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html