[Grace-core] Semantics of object/classes

James Noble kjx at ecs.vuw.ac.nz
Wed Aug 8 04:19:47 PDT 2012


On 8/08/2012, at 17:24 PM, Andrew P. Black wrote:

> My attempts to describe how object constructors and inheritance should work are on the Wiki:
> 
> https://projects.cecs.pdx.edu:8443/~black/NewOOL/index.cgi/wiki/ObjectConstructorDescription
> https://projects.cecs.pdx.edu:8443/~black/NewOOL/index.cgi/wiki/InheritanceFromObjects

another question about this:

in the InheritanceFromObjects page, where a bicycle inherits from a car, you say

> In addition to methods, code can also appear inside a block that is bound to a field of the object.   As far as resolving its free variables is concerned, this code is treated in exactly the same way as code in a method.

so the question is: if your "car" super-object had a field defined as

def question is public, readable = {self.numberOfSeats} 

what does bicycle.question return? 

if it returns 1 rather than 4, *how* does it return 1?


(if I was being picky, I'd point out that code can also appear inside a (top-level) block that is *not* bound to a field of the object;
the block could be passed off to another external object or method?  As indeed can self.

James



More information about the Grace-core mailing list