[Grace-core] NS inheritance cannot work for grace

Michael Homer michael.homer at ecs.vuw.ac.nz
Tue Nov 28 22:42:05 PST 2017


On 29/11/2017, at 18:59, kjx <kjx at ecs.vuw.ac.nz> wrote:
> 
> On 28/11/2017, at 18:07PM, Richard Roberts <rykardo.r at gmail.com> wrote:
>> 
>> So, I'm coming to the realization that SOMns inheritance cannot work,
> 
> Hmm.  I'm still not sure how much of that is to do with issues of SOM(ns)
> and how much to the "flexibility" (or "undefinedness") of Grace's inheritance model.
> 
> So I just typed up a long rant, and to be a good citizen, lodged it as an issue. 
> 
> https://github.com/gracelang/language/issues/134
> 
> TL;DR - our current definitions seem simultaneously very flexible 
> but in some ways very restrictive too.  Part of this is due to the 
> two-way articulation between declarations and idioms; part of 
> it due to the current wording of the inheritance rules.
> 
> I can see two options at this point: either reduce the flexibility
> making Grace's inheritance rather more static and clearly defined
> (what Michael used to call "real classes") or accept the flexibility
> of JS and raw Truffle, and adopt a highly dynamic model. 
If this is inheritable:
    method evil {
       if (random.boolean) 
          then { object { var x: = 3; def y = 2;} }
          else  { object { var x: = 3000; def y = 2000 } }
    }
then this should be too:
    def x = object {
        method p { object { } }
    }
    method parent(o) { o.p }
    object { inherit parent(x) }
A system where methods become inheritable or not based on the values of their arguments seems dubious to me. It also pushes the “cannot be overridden” criterion deeply through the entire potential call stack (if I can override “random”, evil is no longer reliable). That’s not even related to the choice element of the example.

Otherwise, yes.
-Michael


More information about the Grace-core mailing list