[Grace-core] Early experience with traits not overriding superobject

James Noble kjx at ecs.vuw.ac.nz
Thu Mar 10 15:37:24 PST 2016


> Apparently, my post wasn’t clear.  

sorry - I'm not trying to troll.

I recall default methods was *the* important outstanding issue we didn't get to in Portland.
and I don't have it in my model

> The problem has nothing to do with traits getting default methods.
>  It arises because classes inherit default methods

because class objects inherit default methods or because default methods come through "inherit" clauses
in the way they don't through "use" clauses? 

> I did only use traits.  That’s the problem.

if you only use traits, and "use" clauses, I don't see how there can be a problem.

If all objects (including naked trait instances) have default methods
then it seems every trait must clash with every other trait at the default methods anyway:

if one trait defines new versions for one or more default methods, 
I thought you had a rule that said  that those new versions  of the default methods
override all the default versions of the default methods 
coming in from every other trait - is that right?

you'd talked about a cut-down version of the "meet" operator that only applied when one or both arguments
was a method body declared in "graceObject"

If so, why can't you just apply the same rule to both "use" parents and the "inherit" parent? 

If not, I'm afraid I still don't understand. 

> Yes, if we get rid of default methods altogether, then this problem won’t be there — we will instead have another problem.  
> Experience has shown that giving all objects minimal behavior is a good idea.


all objects or most objects? 
in the spec "done" doesn't have != or == (and if we stick with that, its hard for me to understand why done has "asString") 

giving most objects default behaviour is a good idea.   type Object or GraceObject, rather than type { }  
the question is how, and what happens if we want to change that behaviour.

my understanding of a traits-based style, from experience with Self traits 20 years ago
was that you try to avoid overriding - fairly high up the hierarchy you pick the key traits you 
want for things like equality (in particular) or whatever, and you don't change those lower down
Or at least, if you do change them, then you have to be explicit about it. 
ideally by using local overriding and named parents to pick one definition.

J


More information about the Grace-core mailing list