Thoughts about in contract inheritance

deadalnix deadalnix at
Wed Feb 29 10:03:21 PST 2012

Le 29/02/2012 17:26, Stewart Gordon a écrit :
> So you think that, once a library is written and released, no new
> functionality should ever be added?

We are reaching the discussion of evolving API.

I do think that if change such a thing, you should rename your function 
to express its new functionality. And mark the previous function as 
deprecated, with forwarding to the deprecated function, when 
appropriate, for a transitional period, so code using the old API have 
some time to adapt before it is removed completely.

Additionally, this transition process require to be able to provide a 
default implementation for interface's function. Java did face the same 
problem (actually it is worse because of bad choice in generic 
implementation) and it will be implemented in java 8 or 9 IIRC.

I think this problem is way more broad than a contract issue. Both seems 
orthogonal to me.

Any change in the base class can mess up its subclasses, the change 
being in contract or somewhere else isn't that important. It is an API 
evolution strategy problem.

More information about the Digitalmars-d mailing list