Does it make sense to remove slots ?
David Hopwood
david.nospam.hopwood at blueyonder.co.uk
Mon Nov 8 15:54:13 PST 2004
Massimo Dentico wrote:
> David Hopwood wrote:
>
>> 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.
>
> Unacceptable: the example of ellipses and circles is perfectly
> valid as representative of situations in the real world.
LSP only allows Circle to be considered a subtype of Ellipse if its
behaviour is identical to a constrained Ellipse, i.e. with equal major
and minor axes. So why not just use an Ellipse with equal major and
minor axes, and reduce the complexity of the system by eliminating
a class?
Essentially the only cases in which it is useful to define a subtype
relation between two concrete classes are cases in which LSP, strictly
interpreted, does *not* hold.
>> But see <http://c2.com/cgi/wiki?DarwenAndDatesTypeSystem>.
>
> This page is void, so...
My apologies, it should have been
<http://c2.com/cgi/wiki?DateAndDarwensTypeSystem>.
>> 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.
>
> .. this is an unsubstantieted claim. Please, explain: their
> model is NOT purely functional by any means, they have
> updatable variables, as in all *imperative* programming
> languages.
Purely functional languages also support updatable variables (e.g.
MVar in Haskell). The differences from imperative languages are in
how they support this. Date & Darwen's system is much closer to pure
functional languages in this respect, it particular, it does not
support multiple references aliasing a mutable object. This makes
it unsuitable for Slate.
--
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>
More information about the Slate
mailing list