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-Thread: 103376,2ff5c149712ec0eb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder4.cambrium.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!newsfeed.freenet.de!news.teledata-fn.de!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada Interfaces and the Liskov Substitution Principle Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <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> <1180529642.741098.224230@q66g2000hsg.googlegroups.com> <1ljmbgesxien.syhurcvjdcd2$.dlg@40tude.net> <1180558336.041236.211560@p77g2000hsh.googlegroups.com> Date: Thu, 31 May 2007 10:15:12 +0200 Message-ID: <1j91i6rk18kqd.4zjp36eyvps3.dlg@40tude.net> NNTP-Posting-Date: 31 May 2007 10:12:54 CEST NNTP-Posting-Host: d866d65b.newsspool1.arcor-online.net X-Trace: DXC=h^`k;gNT:SWYI9]OHn9o5^ic==]BZ:af^4Fo<]lROoRQFl8W>\BH3YR@Z8ZjK:PimVDNcfSJ;bb[UFCTGGVUmh?TLK[5LiR>kgRlPd?3]XaV[[ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:15985 Date: 2007-05-31T10:12:54+02:00 List-Id: On 30 May 2007 13:52:16 -0700, Maciej Sobczak wrote: > On 30 Maj, 15:56, "Dmitry A. Kazakov" > wrote: > >>>> 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. >> >> No shared semantics in this context. The values identify themselves, >> otherwise the type shall be limited and no assignment would come in >> question. > > When I think about it, it seems to me that you have just pinned down > the very essence of this problem. > There is no need to artificially banning assignments for class-wide > types. Just force them all to be limited. Problem solved. > > I'm not joking. You cannot make a class of non-limited types limited. It would be inconsistent. A specific object is just a constrained instance of a class-wide object. This is the model of what is going on. Whether the objects from the class should or not have assignment or any other operation depends solely on the problem domain. It is the programmer's choice. > There is a distinction between value types and object types. Between objects with and without identity. > These > names might not be meaningful within the Ada terminology, but the > border line is basically between types which instances represent > themselves and those which instances represent external concepts or > entities (but not necessarily). The latter often form hierarchies. > When I said that I've never seen reasonable assignment with a > hierarchy, it expressed exactly this distinction. Assignment is for > values, not for objects. No. In fact, it is much simpler. There is no magic in identity, which is just a mapping object->ID value. You cannot assign an object with identity in terms of its "value" only. This is quite obvious, because such object is a pair: (ID, Value). How to build a pair using only one component of? But the pair itself is again a plain value which can be assigned, why not? The source of confusion is only in an unsound type system people have in mind. The types of a pair and its component are different. The value of a polymorphic object is a pair (Type-ID, Specific-value). When a type is made limited, this not because its class-wides will have Type-ID, called Tag in Ada. It is because there is an identity of be it plain or polymorphic object in the problem domain. These are independent identities. > And guess what? You often need generics (templates, etc.) for value > types. Don't get rid of them yet. ;-) I *never* need generics in the following sense. If a language L cannot be used without some meta language M (templates), then scrap L and use M instead: L := M; -- (:-)) If neither L nor M is really usable alone, then guess what? Redesign one of them! >>> Even with strings, you might want to share the strategy for character >>> encoding. >> >> I don't. String has a value, only this counts. > > According to the above distinction, string is a value type. As well as the polymorphic string from the class of: (UTF-8, "abc") := (ASCII, "def"); -- Why is it a problem? >> Why should I *statically* know string bounds and encoding? Any reason? > > You might simply want to. For example, to separate domains. If I wanted this I would put a corresponding constraint, not otherwise. I don't want the language to impose arbitrary constraints on my design. >>>> 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. >> >> How? To dispatch you need a class, which you have just scraped. > > Internal strategy can be a class. That's a good place for dispatch > (note: I use the term "strategy" from the OO design pattern with the > same name). This is what I meant. Let's move to the internals. How the internal class can be assigned? Can it? >>>> 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. >> >> How to instantiate a template when the type is unknown? > > You don't. What was the problem? That I can't. Show me an implementation of an editor based generic strings: generic with type Char is private; Length : Natural; package Mess is type String is array (1..Length) of Char; ... >>>> 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. >> >> And to whom delegates the conversion library? (:-)) > > Why should I bother? You should not, except that delegating is not about work, it is management. I suppose, MS Project is the "language" for that... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de