Re: [spr35301] make-<some-struct> performance
Didier Verna <[email protected]> Wed, 26 Nov 2008 10:20:35 +0100
| Newsgroups | gmane.lisp.allegro |
|---|---|
| Message-ID | <[email protected]> |
Hi again Duane,
Duane Rettig wrote:
> I personally use defstruct quite a bit, but mostly for speed, and it
> has been my observation that most of our customers use defstruct for
> speed as well; when type checking and especially usage of the MOP to
> create special considerations and checking for building lisp objects,
> they tend to use CLOS.
>
> I am not adverse to adding optional checking to slot-options, but it
> simply isn't a very high priority. [...] A workaround is to use CLOS
> objects, at least for the debugging phase of your program
I'm coming back to you because I'm a bit confused. What you wrote
above made me think that ACL would perform type checking on CLOS
objects'slots, if not on structure slots. But this doesn't seem to be
the case either. For instance, this code doesn't trigger any error (not
when instanciating the class, not when modifying the slot value or
whatever):
| (declaim (optimize (speed 0)
| (compilation-speed 0)
| (safety 3)
| (debug 0)))
|=20
| (defclass foo ()
| ((slot :type single-float :initform "bar")))
Two other remarks: 1/ switching to (speed 3) (safety 0) makes no
difference, and 2/ the application's resulting behavior is not
"undefined" as the standard allows, but coherent, in the sense that
objects of *any* type can be correctly written and read back from the
slot, just as if the :type option was not given.
So I guess my ultimate question is: is the :type slot option actually
used in any situation at all in ACL ?
Thanks.
--=20
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
EPITA/LRDE, 14-16 rue Voltaire, 94276 Le Kremlin-Bic=EAtre, France
Tel. +33 (0)1 44 08 01 85 Fax. +33 (0)1 53 14 59 22