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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2ff5c149712ec0eb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!u30g2000hsc.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Interfaces and the Liskov Substitution Principle Date: 30 May 2007 00:40:14 -0700 Organization: http://groups.google.com Message-ID: <1180510814.812025.251580@u30g2000hsc.googlegroups.com> References: <1179953657.839272.160320@a26g2000pre.googlegroups.com> <1179991769.376381.252010@m36g2000hse.googlegroups.com> <12h6mi42jcha0.7f9vfsnihjwr$.dlg@40tude.net> <1180011507.159515.46920@o5g2000hsb.googlegroups.com> <1180079541.558215.256570@h2g2000hsg.googlegroups.com> <1180124867.710641.176330@k79g2000hse.googlegroups.com> <1k165n4jwxna3$.1mpx49xvcrc0z$.dlg@40tude.net> <1180254636.632499.3340@o5g2000hsb.googlegroups.com> <1p717twnydnre$.1j6izygvqo832.dlg@40tude.net> <1180425803.422075.100090@o5g2000hsb.googlegroups.com> <1180452858.118039.67740@w5g2000hsg.googlegroups.com> NNTP-Posting-Host: 137.138.37.241 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1180510819 30384 127.0.0.1 (30 May 2007 07:40:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 30 May 2007 07:40:19 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.10) Gecko/20070228 Red Hat/1.5.0.10-0.1.slc3 Firefox/1.5.0.10,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: u30g2000hsc.googlegroups.com; posting-host=137.138.37.241; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:15974 Date: 2007-05-30T00:40:14-07:00 List-Id: On 29 Maj, 19:07, "Dmitry A. Kazakov" wrote: > > We are talking about real: > > > X := Y; > > Huh, how are going to design a non-referential container of T'Class? I don't. :-) Polymorphism and references come hand in hand if you need the ability to reassign. Copy-initialization is the only place where you can safely get away with "values" of T'Class. I think that the mess has its source in the push to have T'Class behaving like normal value. > > I say that you need one type String, that possibly uses strategy > > internally to delegate details like encoding. You don't need encoding > > to "leak out" at the level of types that the final user operates on. > > That would be indeed a mess. How would you pass an UTF-8 string to GTK+ > which knows nothing about your fancy patterns? Then it should know. Otherwise there is no way it can interpret correctly what I pass as parameters, unless you want to have "implicit" conversions for parameters. > Why don't you use the > advantages of the types system? I do use it, I just don't elevate implementation details to the level of type that is handled directly by the user. > > You can (and should) have dispatching internally in the implementation > > of operations of String. I'm not proposing any case statements here! > > Here you are. What is the difference between internally and externally > dispatching assignments? Assignment is an operation that is meaningful syntactically - that's why it is so tempting. Internally you can have anything else, including regular subprogram calls that will do necessary conversions. > >> Why a fixed string > >> shouldn't be assigned to an unbounded one and reverse? > > > Of course it should! > > q.e.d. > > > What about template methods? ;-) > > Static polymorphism is exactly what I am trying to get rid of... (:-)) Here you are. :-) Then we will never get into any agreement. > Static polymorphism does not allow mixing types. ? > Further you cannot design > a library for formatting strings which would not be generic itself. 1. So? 2. Yes, I can. Just use arbitrary string type for formatting and then convert to the destination type. > Generics is a dead end. Hm... > > Looks like you guys need *real* templates. ;-) > > Surely they have them ... for formatting RM texts. See the difference? > (:-)) :-) > > But then the compiler would need to either force you to implement the > > whole square of assignment operations, or use run-time checks to > > discover whether the assignment within a given pair of leaf types is > > provided. > > The former is unrealistic with evolving or open-ended hierarchies, the > > latter smells more like Python than Ada. > > The latter is what Ada does now, and I agree that this is not Ada (TM). Agreed. > The former is quite possible and IMO is the only right way to go. Note that > the language should also allow declaring symmetries of the methods to > reduce the number of independent variants. Yes, but that reduces the complexity by a constant only, the problem is still fundamentally squared. -- Maciej Sobczak http://www.msobczak.com/