LSP (was Re: Function.prototype.bind)

Jon Zeppieri jaz at
Mon Sep 22 16:50:52 PDT 2008

On Mon, Sep 22, 2008 at 6:25 PM, Waldemar Horwat <waldemar at> wrote:
> Graydon Hoare wrote:
>> Quoting Liskov[1]:
>>    "What is wanted here is something like the following substitution
>>     property: If for each object o1 of type S there is an object o2 of
>>     type T such that for all programs P defined in terms of T, the
>>     behavior of P is unchanged when o1 is substituted for o2, then S
>>     is a subtype of T."
>> Think it over. Imagine what you'd have to delete from any language you
>> use, for its "subtype" relation to conform to that definition.
> What?  For example, what would you have to delete from Java, ignoring the parts where a program can examine itself like reflection?

I don't know that I would phrase it in terms of deleting functionality
from the language, but it's pretty clear that Java's notion of
subtyping is not Liskov's.  Here's a simple illustration:

More information about the Es-discuss mailing list