[Grace-core] Inheritance and object initialisation

James Noble kjx at ecs.vuw.ac.nz
Sun Jul 22 04:25:25 PDT 2012


On 21/07/2012, at 09:27 AM, Kim Bruce wrote:

> A problem I don't know how to overcome at all(though perhaps less common) is what to do with statements like
>    def x is readable = self.m(...)    // self added just for emphasis

RIght - I didn't address this in the long screed I just sent, but I should have:
Basically yes, given this the only option is to override the variable in a subobject
and redefine that variable there.  That's a significant problem. The other 
option is to make a readable var - and then rely on the delegation semantics
that a subobject (i.e. one delegates to the object holding the variable) is 
counted as "self" for the purpose of access control, so it can change the 
variable although no outside clients can.

Of course this illustrates another well-known problem with the delegation
model: unless you have some way to forbid delegation, any access control
can be overridden by an attacker object delegating to you - i.e. becoming
your subobject, and thus "part" of you. 

That also reminds me Kim's presenting problem is to do with object initialisation.
I've added two "*hardhat*" papers to the background repository - Yossi Gil's paper
proposing the "hardhat" constructor design, and the ECOOP 2012 paper showing
how that design was adopted in X10.   Even if we don't want to be anywhere nearly
as strict as that design, it is something (else) that our annotation system should be
able to support in a dialect. See gil-hardhat-ecoop09.pdd and x10-hardhat-ecoop12.pdf

James


More information about the Grace-core mailing list