From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: Re: Subtype conformance... not what I was expecting.
Date: Wed, 26 Jul 2006 17:38:50 +0200
Date: 2006-07-26T17:35:54+02:00 [thread overview]
Message-ID: <1153928329.4980.14.camel@localhost> (raw)
In-Reply-To: <44c77cf0$0$2917$4d3efbfe@news.sover.net>
On Wed, 2006-07-26 at 10:32 -0400, Peter C. Chapin wrote:
Sounds like the technical/mathematical versus practical/real-world
co(ntra)variance issue?
> Using the notation common in functional languages, let F : t1 -> t2 and
> G : t1' -> t2'. Then t1 -> t2 is a subtype of t1' -> t2' (that is,
> t1->t2 <: t1'->t2') iff t2 <: t2' and t1' <: t1. In this case I realize
> that G is an access type but it "feels" like a function when it is used.
> Since I'm trying to use F where G is expected and since F and G have the
> proper subtype relationship to each other one might suppose that the
> above rule would be obeyed.
Let F : Person -> Room and G : Girl -> Girls_Dormitory.
Then Person -> Room is a subtype of Girl -> Girls_Dormitory (that is,
Person->Room <: Girl->Girls_Dormitory) iff Room <: Girls_Dormitory
and Girl <: Person.
Let F : Girl -> Girls_Dormitory and G : Person -> Room.
Then Girl -> Girls_Dormitory is a subtype of Person -> Room (that is,
Girl->Girls_Dormitory <: Person->Room) iff Girls_Dormitory <: Room
and Person <: Girl.
Now add Boy.
Granted Persons and Rooms are distinct type classes, but are the
transcriptions correct otherwise? (The example is from Meyer's OOSC2
as I remember it, but I don't have the book here to check.)
next prev parent reply other threads:[~2006-07-26 15:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-26 3:02 Subtype conformance... not what I was expecting Peter C. Chapin
2006-07-26 6:58 ` Craig Carey
2006-07-26 7:54 ` Dmitry A. Kazakov
2006-07-26 14:32 ` Peter C. Chapin
2006-07-26 15:38 ` Georg Bauhaus [this message]
2006-07-27 0:02 ` Peter C. Chapin
2006-07-26 18:40 ` Dmitry A. Kazakov
2006-07-27 0:00 ` Peter C. Chapin
2006-07-26 8:06 ` Georg Bauhaus
2006-07-26 14:15 ` Peter C. Chapin
2006-07-26 21:23 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox