[pro] Sensible interpretation of declarations in CLOS
pc at p-cos.net
Wed Oct 10 17:53:22 UTC 2012
You probably already know this, but just to make sure: The CLOS MOP specification doesn't allow any metaobjects that are instances of the predefined metaobject classes to change their classes (except for instances of forward-referenced-class). So in that regard, type declarations that refer to CLOS classes in Common Lisp are still safe.
Note, however, that Common Lisp already allows for changing the (proper) names of classes. So in that regard, you don't even need the CLOS MOP to render type declarations for CLOS classes unsafe. ;)
So my guess is that this is why the restriction in the CLOS MOP was put there in the first place, to have some amount of sanity in this regard.
Just my 0.02€…
On 9 Oct 2012, at 22:44, Juan Jose Garcia-Ripoll <juanjose.garciaripoll at gmail.com> wrote:
> Dear all,
> I am retaking an old question, which is the utility of type declarations in a language that has the flexibility of the MOP.
> In an extremely open-minded setup, where any class is prone to change, not only their structure, but also their metaclass, it would seem that a local declaration of the kind (DECLARE (MY-CLASS FOO)) would be totally useless.
> But... do you actually face that flexibility in real life? I mean, declarations such as (DECLARE (TYPE MY-INTEGER-TYPE FOO)) are used in actual code, where there is an implicit contract that the DEFTYPE type will not be changed in unsafe code. Can't we assume something similar when facing CLOS? What would be a reasonable optimization/safety/debug level to start considering that?
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain)
> pro mailing list
> pro at common-lisp.net
The views expressed in this email are my own, and not those of my employer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pro