Does it make sense to remove slots ?

David Hopwood david.nospam.hopwood at blueyonder.co.uk
Sun Nov 7 22:02:52 PST 2004


Massimo Dentico wrote:
> Todd Fleming wrote:
>> Massimo Dentico wrote:
>>
>>> Tim Moore wrote:
>>>
>>>> Long story short: Todd is right. Circle shouldn't be derived from 
>>>> Ellipse unless they're both immutable, and most likely you don't 
>>>> really need a Circle type at all.

Exactly: you don't need a Circle type at all, so there is no problem
to solve. This applies to a large proportion of cases of supposed
problems involving Liskov substitutability.

>> The squishing problem still exists whether Circle is a subtype of 
>> Ellipse or it inherits from Ellipse, except if
>> they are treated as immutable.
> 
> Well, I remember that in the series of articles by Chris Date
> pointed out by me, "WHAT DOES SUBSTITUTABILITY REALLY MEAN?"
> 
>    http://www.dbdebunk.com/page/page/626998.htm
> 
> he addressed precisely this problem and propose his and Hugh Darwen
> "inheritance model":
> 
>    And we would really like to suggest, with all due respect,
>    that the industry leaders in this field, instead of spending
>    so much time and effort in trying to persuade the rest of us
>    that squares aren't rectangles and circles aren't ellipses,
>    would take a look at our model and see how we do it!

But see <http://c2.com/cgi/wiki?DarwenAndDatesTypeSystem>. Essentially,
Darwen and Date "solve" the subtyping problem by prohibiting objects
from having identity or modelling mutable state. This is only practical
if you have a language that fully supports a pure object-functional
programming style; otherwise the cure is worse than the disease.

-- 
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>




More information about the Slate mailing list