Re: MAKE-INSTANCE and STRUCTURE-CLASS

"Tim Bradshaw (as tfb at cley dot com)" <[email protected]> Mon, 6 Jul 2026 15:56:08 +0100
Newsgroups gmane.lisp.lispworks.general,gmane.lisp.cl-pro
Message-ID <[email protected]>
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 calls 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: how 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

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