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

Michael Homer mwh at ecs.vuw.ac.nz
Sun Dec 7 19:10:44 PST 2014


(Summary: List what you want the inheritance system to allow and facilitate.)

There has been some discussion lately about exactly how inheritance
should work. It would be helpful if that could be resolved one way or
another relatively soon: it's going to affect any future
implementation at a pretty fundamental level, by determining aspects
of the object representation, and dealing with the legacy of past
attempts is part of what complicates Minigrace.

It seems now that some sort of change is inevitable, but it may well
turn out that the current approach is as good as it gets. It may also
be that another approach altogether is required.

Since people have different ideas of what the role of inheritance is
it seems that the best approach is to start by enumerating the things
that should be allowed and facilitated by inheritance, ideally: Where
would inheritance be used in a program?

That means specific effects, programming styles, program structures,
and the like (not generically question-begging the meaning of the
word); a piece or pieces of example hypothetical code and a
characterisation of how it would behave may be helpful in describing
what is desired (inventing special-purpose syntax if necessary). If
there are any things that should be specifically disallowed, setting
those out could be helpful too. Probably it won't be possible to
satisfy all of these criteria, but it should provide a useful
framework for discussion and preempt surprises later on where
something "obvious" to one wasn't considered by others or accounted
for.

Some starter points to consider: What is static, or dynamic? When does
code execute? What is executing code allowed to do at different points
in time? What is the role of parameters? What may be inherited from?
What degree of "opt-out" does user code have? What may differ in an
inheritor? How does it interact with typing? What should be
encouraged, and what merely permitted?

I've avoided characterising any of the options or past discussion
here. I'm hoping that a blank slate and a list of desiderata will
point things in a useful direction. I expect that these lists could be
fairly long and might have a lot of repetition; that's ok.
-Michael


More information about the Grace-core mailing list