comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus.rm.tsoh@maps.futureapps.de>
Subject: Re: Ada Interfaces and the Liskov Substitution Principle
Date: Tue, 29 May 2007 01:00:33 +0200
Date: 2007-05-29T00:57:57+02:00	[thread overview]
Message-ID: <465b5e75$0$6397$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <12abvpqcff.fsf@hod.lan.m-e-leypold.de>

Markus E Leypold wrote:
> 
>> I bet that as soon as someone popularizes a mathematical model

>> If I had the money, I'd put up a challange that triggers some
>> programming oriented model research

> Somehow you seem to think, we can just do away with the models, if we
> just approach it right.

No. We might profit from mathematical models that are even better
because they better reflect what programming staff needs. (Reminds me of
the intent that has led to Ada.)

Perhaps this was misleading:
>> Until then, only this or that kind of variance is allowed to exist,
>> for either mathematical or problem domain reasons, because the
>> other solution cannot but create an unmaintainable mess...

WRT variance, one of Meyer's examples is the allocation of boys and
girls to dormitories.(*)
  Boys and girls are two sexes of the human kind, hence Boy and
Girl are derived from the type Human. Girls' dormitories
and boys' dormitories are two derived types of domitories.
There is a procedure for each Human object, say Person,

  Person.Accomodate(dorm => ?Dormitory?);

that will place a person in a dormitory, such that girls sleep
in the girls' dormitory and boys sleep in the boys' dormitory.
  Shall we have a procedure for boys (or girls) that just takes
a person of the respective sex and places the person in a
dormitory'class?

  procedure Accomodate(who: Boy; dorm: Dormitory'class);

(Of course, the "moral rule" depends on who you ask, but this example
presumes gender segregation in any sexual sense.)

There is a subsection in the corresponding section (OOSC2, �17) entitled
"Polymorphic perversity". It alludes to the consequences of
different "co/contravariance policies", speaking about a procedure that
expresses "sharing a room".

  type Boy is new Human with private;
  overriding
  procedure Share(self: in out Boy; other: in out Boy);

This definition meets the requirement that a boy and a girl shall not
share a room.
OTOH, there are also technical arguments in favor of defining a
procedure that doesn't vary in the same "direction" as the type,
thus

  type Boy is new Human with private;
  overriding
  procedure Share(self: in out Boy; other: in out Human'class);

Which co/contravariance policy is right? And therefore, can we
decide which model is the right one if all that we can say about a
model is that it is mathematically sound in some sense?
  Of course it is, but soundness is very likely just a necessary
precondition. Whether a model is sufficient, and more precisely,
in which cases it is sufficient, these are the more interesting
questions (to me, at least).

(*) (There are certainly other solutions that do not
involve inheritance, but this is the illustration given. I'm varying it
slightly.)



  reply	other threads:[~2007-05-28 23:00 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-23 19:47 Ada Interfaces and the Liskov Substitution Principle Stefan Lucks
2007-05-23 20:32 ` Ludovic Brenta
2007-05-23 22:00   ` Randy Brukardt
2007-05-24  0:56     ` Anh Vo
2007-05-24 18:27     ` Pascal Obry
2007-05-24 18:39       ` Dmitry A. Kazakov
2007-05-24 18:51         ` Pascal Obry
2007-05-24 22:44         ` Randy Brukardt
2007-05-24  6:57   ` Stefan Lucks
2007-05-23 20:54 ` Maciej Sobczak
2007-05-23 21:58   ` Randy Brukardt
2007-05-24  7:29     ` Maciej Sobczak
2007-05-24  8:02       ` Dmitry A. Kazakov
2007-05-24 12:58         ` Maciej Sobczak
2007-05-24 13:42           ` Dmitry A. Kazakov
2007-05-24 22:08           ` Robert A Duff
2007-07-01  1:00             ` David Thompson
2007-05-24 22:58           ` Randy Brukardt
2007-05-25  7:52             ` Maciej Sobczak
2007-05-25  8:21               ` Dmitry A. Kazakov
2007-05-25 20:27                 ` Maciej Sobczak
2007-05-26  7:48                   ` Dmitry A. Kazakov
2007-05-27  8:30                     ` Maciej Sobczak
2007-05-27 10:04                       ` Dmitry A. Kazakov
2007-05-29  8:03                         ` Maciej Sobczak
2007-05-29 13:18                           ` Dmitry A. Kazakov
2007-05-29 13:32                             ` Dmitry A. Kazakov
2007-05-29 15:34                             ` Maciej Sobczak
2007-05-29 17:07                               ` Dmitry A. Kazakov
2007-05-30  7:40                                 ` Maciej Sobczak
2007-05-30  8:43                                   ` Dmitry A. Kazakov
2007-05-30 12:54                                     ` Maciej Sobczak
2007-05-30 13:56                                       ` Dmitry A. Kazakov
2007-05-30 16:49                                         ` vgodunko
2007-05-30 20:52                                         ` Maciej Sobczak
2007-05-31  8:15                                           ` Dmitry A. Kazakov
2007-05-31 13:46                                             ` Maciej Sobczak
2007-06-01  7:29                                               ` Dmitry A. Kazakov
2007-06-01 13:32                                                 ` Maciej Sobczak
2007-06-01 14:53                                                   ` Dmitry A. Kazakov
2007-06-01 20:31                                                     ` Maciej Sobczak
2007-06-02  8:19                                                       ` Dmitry A. Kazakov
2007-06-02 16:49                                                         ` Maciej Sobczak
2007-06-03  7:09                                                           ` Dmitry A. Kazakov
2007-06-03 22:04                                                             ` Maciej Sobczak
2007-06-04  8:08                                                               ` Dmitry A. Kazakov
2007-06-04 17:02                                                                 ` Maciej Sobczak
2007-06-05  8:35                                                                   ` Dmitry A. Kazakov
2007-06-05 22:12                                                                     ` Maciej Sobczak
2007-06-06  8:21                                                                       ` Dmitry A. Kazakov
2007-06-06 14:46                                                                         ` Maciej Sobczak
2007-06-06 15:11                                                                           ` Maciej Sobczak
2007-06-06 15:32                                                                       ` Markus E Leypold
2007-05-24 10:42       ` Georg Bauhaus
2007-05-24 13:41         ` Dmitry A. Kazakov
2007-05-25 16:59         ` Markus E Leypold
2007-05-28  9:52           ` Georg Bauhaus
2007-05-28 11:50             ` Dmitry A. Kazakov
2007-05-28 23:32               ` Georg Bauhaus
2007-05-29 12:05                 ` Dmitry A. Kazakov
2007-05-29 13:33                 ` Georg Bauhaus
2007-05-29 17:29                   ` Dmitry A. Kazakov
2007-05-29 20:46                     ` Georg Bauhaus
2007-05-30  7:53                       ` Dmitry A. Kazakov
2007-05-30 13:18                       ` Georg Bauhaus
2007-05-31 10:27                         ` Dmitry A. Kazakov
2007-05-31 11:44                         ` Georg Bauhaus
2007-06-01  7:37                           ` Dmitry A. Kazakov
2007-06-01 10:07                             ` Markus E Leypold
2007-06-01 11:41                             ` Georg Bauhaus
2007-06-01 13:07                               ` Dmitry A. Kazakov
2007-05-28 13:47             ` Markus E Leypold
2007-05-28 23:12               ` Georg Bauhaus
2007-05-28 13:56             ` Markus E Leypold
2007-05-28 23:00               ` Georg Bauhaus [this message]
2007-05-24  7:39 ` Dmitry A. Kazakov
2007-05-24 11:12   ` Stefan Lucks
2007-05-24 13:56     ` Dmitry A. Kazakov
2007-05-24 14:41       ` Stefan Lucks
2007-05-24 15:46         ` Dmitry A. Kazakov
2007-05-24 15:00       ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox