[Grace-core] Inheritance in Javascript version

Michael Homer mwh at ecs.vuw.ac.nz
Mon Aug 12 14:10:58 PDT 2013


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