[Grace-core] Inheritance: what is it meant to be good for?

Kim Bruce kim at cs.pomona.edu
Wed Dec 10 00:27:17 PST 2014


The most straightforward answer is that the most common languages that students will be moving to will use inheritance.  If we use delegation that we will make the language less attractive to faculty who want their students to move next to a language using inheritance.

A more principled answer has to do with shared state with delegation.  If you have mutable objects that you are delegating to then if the object is delegated to more than once then you get unforeseen side-effects.  Andrew will likely disagree, but I find the delegation model harder to explain to students as self is the delegator in the delegatee.

It is the case that object-based languages are more likely to use delegation than inheritance (and our struggles with defining inheritance explain why).  But most students will be moving to a class based language from Grace and will use inheritance.

Kim



On Dec 10, 2014, at 12:15 AM, James Noble <kjx at ecs.vuw.ac.nz> wrote:

> [Alex asked me to post this because his email didn't make it through to the list]
> 
> Hello,
> 
> I must have missed the discussion before, but I am just wondering - why
> inheritance? Why not have delegation or other composition mechanisms and
> omit it entirely?
> 
> Thanks,
> Alex.
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core




More information about the Grace-core mailing list