From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e1bb9627c57b7d5b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-18 03:52:36 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!dialin-145-254-040-235.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: U : Unbounded_String := "bla bla bla"; (was: Is the Writing...) Date: Sat, 18 Oct 2003 12:57:54 +0200 Organization: At home Message-ID: References: <8e8novk48g4g7ucvtmfh83jbbt57jg809m@4ax.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-040-235.arcor-ip.net (145.254.40.235) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 1066474355 26273131 145.254.40.235 (16 [77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:1118 Date: 2003-10-18T12:57:54+02:00 List-Id: 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 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 to ! > > 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