Hi,

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. ;)

Common Lisp in general has a more traditional performance model, in that it 
relies on staticish compilation for performance, rather than dynamic 
compilation as is done in Java, JavaScript, Lua, etc. With dynamic compilation, 
such issues may be easier to tackle, although I suspect that this would require 
still some non-trivial amount of research. (Changing the metaclass of a class 
needs to update not only the class, but also its instances, and since you 
potentially have an unlimited depth in the hierarchy of metaclasses, this can 
be quite complicated to express in a sane way.)

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€…

Pascal

On 9 Oct 2012, at 22:44, Juan Jose Garcia-Ripoll 
<juanjose.garciarip...@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?
> 
> Best,
> 
> Juanjo
> 
> -- 
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain) 
> http://juanjose.garciaripoll.googlepages.com
> _______________________________________________
> pro mailing list
> pro@common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro

--
Pascal Costanza
The views expressed in this email are my own, and not those of my employer.



_______________________________________________
pro mailing list
pro@common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro

Reply via email to