LSP (was Re: Function.prototype.bind)
graydon at mozilla.com
Wed Sep 24 17:00:34 PDT 2008
waldemar at google.com wrote:
>> This is seriously belaboring a point, but ... I'll try again. The LSP
>> describes this subtype relationship here iff:
>> for every object o1 of type NotTheMulYoureLookingFor:
>> there is an object o2 of type Mul:
>> such that for all programs P:
>> the behavior of P(o2) is the same as P(o1)
>> The only wiggle room I can see here is if you're saying that instances
>> like o1 are also "objects of type Mul", such that you can let o2=o1 and
>> trivially satisfy it.
> Yes, that's what it means here. The LSP applies because you can let
> o1=o2. This is not always a trivial transformation because in some
> languages values of different types are not necessarily compatible.
But then the LSP is saying ... that you should define "subtype" as "the
relation between any two things that are subtypes". It's vacuous if you
read it that way. I think that is not the correct reading at all.
More information about the Es-discuss