Comment 3 for bug 894241

Revision history for this message
sds (sds-gnu) wrote : Re: [Bug 894241] Re: mop for structures

> * Nikodemus Siivola <email address hidden> [2012-04-19 12:47:54 +0000]:
>
> The benefit of our current "defstruct initiargs aren't make-instance
> initargs" approach is that makes it more likely to pinpoint places
> where you've left a make-instance in place after switching to structs.

and how valuable would this be?
after all, this is a run-time detection!
you can do better before even compiling - using grep!
(that is, if the class name in the make-instance call is a constant; if
it is dynamically constructed, then the switch to defstruct become much
more complicated).

> The benefit of allowing defstruct initargs to be used with make-instance
> is that it makes switching between the two definitions less painful.

Precisely! defstruct is just a cheap way to define objects, a
quick-and-dirty alternative to defclass for interactive experimentation,
their killer feature is the automatic readable printability;
the more advanced features are available for defstruct, the better.

> Given that our current approach doesn't guarantee catching all such
> sites anyhow, but adding an error-signaling method on eg. initialize-
> instance does[*] ... I think I'm in favor of allowing defstruct
> initargs in make-instance.

good.
you might want to consider implementing The structure Meta-Object Protocol
http://clisp.org/impnotes/defstruct-mop.html
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://memri.org http://iris.org.il
http://www.memritv.org http://thereligionofpeace.com http://honestreporting.com
To be popular with ladies one has to be smart, handsome & rich. Or to be a cat.