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!q66g2000hsg.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 05:54:02 -0700 Organization: http://groups.google.com Message-ID: <1180529642.741098.224230@q66g2000hsg.googlegroups.com> References: <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> <1180510814.812025.251580@u30g2000hsc.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 1180529643 24605 127.0.0.1 (30 May 2007 12:54:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 30 May 2007 12:54:03 +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: q66g2000hsg.googlegroups.com; posting-host=137.138.37.241; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:15977 Date: 2007-05-30T05:54:02-07:00 List-Id: On 30 Maj, 10:43, "Dmitry A. Kazakov" wrote: > > 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. > > Are you going to sell me pointers, right here, in c.l.a? (:-)) Don't you call them access variables? :-) > Referential semantics is an implementation detail. No, it is not. It gives you explicitly the possibility to "reseat" the referer as well as sharing semantics. These are not details. Even with strings, you might want to share the strategy for character encoding. > But it would be in vain, because assigning class-wide > references in this context is semantically equivalent to assigning the > targets. Which I say should be banned, because the targets are not statically known. > >> 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. > > It cannot, it is ANSI C. Then you need to call it somehow - anyway. How is the proliferation of string types supposed to help here? > I don't see any handling required. But let it be, then how is it different > from your void * approach? When did I say void*? It is spelled "interface". > When you create a void * you have to somehow > specify the hidden parameter of the case-statement: > > void * X = Create_UTF8 ("foo"); > > With types you just specify the type of the object instead: > > X : UTF8_String := "foo"; Which - again - is not an assignment. Just a reminder - we are talking about: X := Y; > The question is how do I do dispatching assignment? Just don't. :-) > Your point was that I shall not do it publicly. But, may I dispatch > privately? Privately you can dispatch to your internal strategies to get character conversions, buffers, etc. > >> Static polymorphism does not allow mixing types. > > > ? > > Instances from a statically polymorphic class of types are unrelated types. > You cannot have any polymorphic object from that class, only specific > objects. For the same reason you cannot have any class-wide operation from > that class. So? > >> Further you cannot design > >> a library for formatting strings which would not be generic itself. > > > 1. So? > > Write an editor for such strings, store a string, send it over the network, > do anything after uninstalling the compiler ... Still don't see the problem. > > 2. Yes, I can. Just use arbitrary string type for formatting and then > > convert to the destination type. > > Why should I bother to have UTF-8 or ASCII strings if anything is > Wide_..._Wide_Unbounded anyway? The Wide_..._Wide_Unbounded can be useful as an intermediary format for conversion between other types, which themselves might still be very useful providing their own characteristics. > What are you going to do if the endianess > of Wide x n Character does not fit your machine? And why should I bother with endianness here? > Whatever pattern you use, you will have to deal with this number of > cases. Or I just delegate to locale and conversion library that is part of my operating system. On my system I can have LOTS of different locales: $ locale -a | wc -l 502 Do you really expect me to have 502 classes in my program just for strings? -- Maciej Sobczak http://www.msobczak.com/