[Grace-core] Inheritance in Javascript version

Kim Bruce kim at cs.pomona.edu
Mon Aug 12 14:30:52 PDT 2013


I'm happy to have it private as long as I know how to annotate it to make it confidentially readable and writable (and not public).  What should I write there?

I believe readable has meant publicly readable, but perhaps that should be changed.  Can we make a decision on this in our meeting tomorrow (at 3 p.m pdt)?  I'm anxious to write some more code, but this is blocking me.

Kim



On Aug 12, 2013, at 2:10 PM, Michael Homer <mwh at ecs.vuw.ac.nz> wrote:

> On Tue, Aug 13, 2013 at 6:18 AM, Kim Bruce <kim at cs.pomona.edu> wrote:
>> The following code works in the C-backend, but not in the javascript backend:
>> 
>> class c.new {
>>    var theWidth := 0
>> }
>> 
>> class d.new {
>>    inherits c.new
>>    method width := (w:Number) -> Done {
>>        theWidth := w
>>        print(theWidth)
>>    }
>> }
>> 
>> def x = d.new
>> x.width:= 5
> This should really be an error in both versions but at some point it
> has stopped failing for C (probably when factory inheritance was
> merged and I missed updating a case). By the rules you put in place
> last year theWidth is lexically bound and not accessible from the
> subclass.
> 
> If you'd like to consider revising that decision, though...
> -Michael




More information about the Grace-core mailing list