comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: U : Unbounded_String := "bla bla bla"; (was: Is the Writing...)
Date: Sat, 18 Oct 2003 12:57:54 +0200
Date: 2003-10-18T12:57:54+02:00	[thread overview]
Message-ID: <bmr61i$p1pbb$1@ID-77047.news.uni-berlin.de> (raw)
In-Reply-To: mailman.97.1066297444.25614.comp.lang.ada@ada-france.org

Alexandre E. Kopilovitch wrote:

> Dmitry A. Kazakov wrote:
> 
>> >I disagree with use of sub- prefix for something that is not a proper
>> >restriction (in some respect) relative to the base.
>>
>> There are clear restrictions:
>>
>> A, a subtype of B (A <: B), means that A is substitutable for B =
>> there is a conversion forth and back to B.
>>
>> B, a supertype of A (B :> A) means A <: B.
> 
> I meant that "subtype" should be in some sense smaller then the base type,
> or at least should be somehow subordinate to the base type. But for the
> relations you presented it is unclear which kind of subordination they
> imply. Can you put it all in more rigorous terms?

The above is far more rigourous than "to be smaller in some sense". Smaller
in which sense? Remember the fundamental principle - we are talking not
about values, but mappings between them. If you would try to define that
"smaller" you will inevitable come to my definition, though putting an
additional constraint that in any case a forth-conversion should be always
possible. So looking at _legal_ Ada you will discover:

type A is new B with null record; -- is a subtype, A is same as B
type A is new B with record ...;  -- not a subtype, A is not smaller
type A is new B with private;     -- maybe a subtype, should look in private

Do you want such a "rigorous" definition? I don't. This is the way LSP goes.
So the notion of LSP subtype depends on the program semantics and thus
becomes almost useless.

> Well, I must tell you that there are people that have more than one
> background,
> and mathematics can be just one of them -:)  Yes, this phenomen is not
> common, but nevertheless it happens sometimes.
> 
>> It is not about
>> rectangles, it is about types, i.e. about sets of rectangles in
>> general. Now consider this statement:
>>
>> for all X, Y there is a <rectangle> with height=X and width=Y
>> 
>> For a square to be a LSP-subtype of rectangle, means that the above
>> will remain true if you change <rectange> to <square>!
> 
> Incorrect, though. Your example statement is not about all rectangles...
> it isn't sufficient just use the words "for all" somewhere in the
> statement -;)

The above was just a formal equivalent of:

type Rectange is tagged ...;
function Create (Height, Width : Float) return Rectangle;

type Square is new Rectangle with null record;
function Create (Height, Width : Float) return Square;

Now you have overridden Create, but you cannot implement it! So LSP claims
that Square is not a subtype of Rectangle. [ There are many ways to mend it
to some extent. ] But the lesson to learn is LSP-subtype /= subset, and to
amazement of anybody aware of geometry, consequently, Square is not a
Rectangle [ when you are considering a program ]. Nice, isn't it?

>> >> >> I want a
>> >> >> fundamentally new, universal concept of subtyping which would cover
>> >> >> all known cases.
>> >
>> >Do you mean that this concept is completely original, or you have some
>> >references to somehow similar concepts?
>>
>> The idea is too simple to call it a concept.
> 
> But it may be just starting, undeveloped idea; and it may appear that it
> has unavoidable consequences, which lead to substantial extension etc.,
> etc.
> 
>> As for implementations, I know no language, which allows this.
> 
> Isn't it strange? Simple idea, allegely useful, but still unused after 50+
> years of programming.

Huh, how about ten commandments? Even simplier ideas and much longer period
of time!

-- 
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-10-18 10:57 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-02 18:02 U : Unbounded_String := "bla bla bla"; (was: Is the Writing...) amado.alves
2003-10-03  0:05 ` U : Unbounded String : " Alexander Kopilovitch
2003-10-03 20:46   ` Dmitry A. Kazakov
2003-10-03  9:00 ` U : Unbounded_String := " Preben Randhol
2003-10-03 11:17   ` Jeff C,
2003-10-04  2:49     ` Robert I. Eachus
2003-10-06 23:57       ` Alexandre E. Kopilovitch
2003-10-07  8:51         ` Dmitry A. Kazakov
2003-10-08 19:12           ` Alexandre E. Kopilovitch
2003-10-09  8:42             ` Dmitry A. Kazakov
2003-10-10 20:58               ` Alexander Kopilovitch
2003-10-13  8:35                 ` Dmitry A. Kazakov
2003-10-13 21:43                   ` Alexandre E. Kopilovitch
2003-10-14  8:09                     ` Dmitry A. Kazakov
2003-10-16  9:39                       ` Alexandre E. Kopilovitch
2003-10-18 10:57                         ` Dmitry A. Kazakov [this message]
2003-10-08 23:18         ` Robert I. Eachus
2003-10-09 21:35           ` Alexandre E. Kopilovitch
2003-10-10 18:10             ` Robert I. Eachus
2003-10-11 19:43               ` Alexandre E. Kopilovitch
2003-10-12  5:03                 ` Robert I. Eachus
2003-10-13  9:07                   ` Dmitry A. Kazakov
2003-10-13 14:36                   ` Alexandre E. Kopilovitch
2003-10-13 19:46                     ` Robert I. Eachus
2003-10-14  1:35                       ` Jeffrey Carter
2003-10-14 17:11                       ` Alexandre E. Kopilovitch
2003-10-14 20:26                         ` Mark A. Biggar
2003-10-14 20:58                           ` Robert I. Eachus
2003-10-15 16:59                           ` Alexandre E. Kopilovitch
2003-10-15 20:38                             ` (see below)
2003-10-16  0:31                               ` Alexandre E. Kopilovitch
2003-10-16  2:30                                 ` (see below)
2003-10-16 13:54                                   ` Alexandre E. Kopilovitch
2003-10-16 14:11                                     ` (see below)
2003-10-16  8:01                             ` Dmitry A. Kazakov
2003-10-17 20:26                   ` Randy Brukardt
2003-10-17 21:39                     ` Alexandre E. Kopilovitch
2003-10-17 23:03                     ` Robert I. Eachus
2003-10-23 21:11                       ` Alexandre E. Kopilovitch
  -- strict thread matches above, loose matches on Subject: below --
2003-10-03 12:00 amado.alves
2003-10-03 15:54 ` Mark A. Biggar
2003-10-03 20:41 ` Dmitry A. Kazakov
2003-10-03 16:12 amado.alves
2003-10-04 12:16 ` Preben Randhol
replies disabled

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