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,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How come Ada isn't more popular? 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: <1169531612.200010.153120@38g2000cwa.googlegroups.com> <1mahvxskejxe1$.tx7bjdqyo2oj$.dlg@40tude.net> <2tfy9vgph3.fsf@hod.lan.m-e-leypold.de> <1g7m33bys8v4p.6p9cpsh3k031$.dlg@40tude.net> <14hm72xd3b0bq$.axktv523vay8$.dlg@40tude.net> <4zwt33xm4b.fsf@hod.lan.m-e-leypold.de> <1j7neot6h1udi$.14vp2aos6z9l8.dlg@40tude.net> <1170347180.14376.104.camel@localhost.localdomain> <1nxunq6pci4r1$.1nnigcjicppwy.dlg@40tude.net> <11g5kv93fm3ua.1p5hykfsdax5l$.dlg@40tude.net> <14ejp7cone.fsf@hod.lan.m-e-leypold.de> <1izylgl1pmcxx$.19mkg9x6p946t.dlg@40tude.net> <2nr6t5fyam.fsf@hod.lan.m-e-leypold.de> Date: Mon, 5 Feb 2007 00:00:48 +0100 Message-ID: NNTP-Posting-Date: 05 Feb 2007 00:00:48 CET NNTP-Posting-Host: 5766f2fd.newsspool4.arcor-online.net X-Trace: DXC=AB[ck8T`6f7]E=H1Q9`7874IUK3ccZ[9gkJc:J\e5?QFOo;: X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8941 Date: 2007-02-05T00:00:48+01:00 List-Id: On Sun, 04 Feb 2007 21:44:17 +0100, Markus E Leypold wrote: > "Dmitry A. Kazakov" writes: > >> On Sat, 03 Feb 2007 15:16:21 +0100, Markus E Leypold wrote: >> >>> "Dmitry A. Kazakov" writes: >>> >>>> On Fri, 02 Feb 2007 13:34:21 +0100, Markus E Leypold wrote: >>>> >>> I've been expressing myself sloppily. It should return a CountVal, not >>> an Additive'Class. CountVal(s) could not be added to Vectors -- there >>> is a difference. >> >> When Inc returns CountVal then it is not a member of Additive in the >> result. So you cannot reuse the result for other members of Additive. > > Exactly. So it should not return Additive'Class (which can be added to > other members of Additive'Class), but must return CountVal to prevent > this. If that was the only reason, then that worked perfectly in Ada 83, before Ada 95 broke it for tagged types [there were some reasons, though]: type Isolated_CountVal is new CountVal; -- Done >>>> No, it does Additive'Class! Thus, no problem. > > that means your approach fails. Do you see the different type > structure the approach using generics produces as compared to your > class inheritance approach? First, what was the problem? Moving target is a difficult thing to track. >>>> (note that the goal was polymorphic Inc, if you wanted it covariant that >>> >>> No. The goal was to have mechanism to write the algorithms once and >>> being able to pull various actual operators/procedures from that >>> without replicating the specification of the algorithm. >> >> If you want to reuse Inc's algorithm in various specific Inc, then you >> would use wrappers: > > No I wouldn't. At the most I'd want to instantiate one generic. See: > We are not talking about one procedure. In general we are talking > about whole libraries (i.e. BTree manipulation and search) which > contain -- in extremis -- 10 to hundred procedures, and I certainly do > NOT want to wrap all of them for every new instance differently typed > instance of the problem. That indeed looks like type X is new Y; Compare ONE line vs. hundred instantiations! BTW, there is no generic libraries in a sane sense of this word. Only instantiations of generic libraries are libraries. (:-)) >> Should I show you generic specifications of this mess? > > And it does become better with OO? I doubt that very much. Nobody tied. If the efforts spent on fixing Ada generics were invested into the type system, who knows. > Indeed the > trick is, not to have n+m+1 instances but package instances of > generics into libraries and instantiate whole "world" in one > stroke. I does not work, because it is not a world it is a multiverse of interconnected worlds of different types. The great idea of Ada numeric types with its ranges and accuracy gets lost, because for any of them you have to instantiate all this pathetic mess. It ends up with C-ish everything is double. Generics is not Ada! >> I DON"T want it. I need a clean way to describe an algebra and a lattice >> and then mix and bend them as I want. > > I doubt OO is the way. Nobody seriously tried it. Ironically, but C++ which was started as "C with classes" suddenly turned into #define++! >> I want to be able to derive everything from a scalar. There is >> always much talk about how mathematical are generics and FP, it is >> amazing to me how readily people believe in that. > > So they are wrong? :-)) Perhaps a big conspiracy, like the big C/C++ > conspiracy and the big Java conspiracy. An argumentation to popularity? (:-)) > People, you make me laugh. I don't speak for Ada community. I bet the silent majority is rather with you than with me. > Isn't it avantgarde enough just to use Ada? > Must everyone else in this world be a misguided moron or an evil > propagandist? Huh, c.l.a is a quite tolerant group, IMO. >> You need two interfaces: Array and Weakly_Ordered. > > Which forced me to use tagged type all day long and all the way, where > simply traditional array access would suffice. All types shall be tagged, including Boolean. > Let's have a look at > verifiability: I'm sure, generics can be verified better and easier. I > heard something about tagged types being really out in that sector, > and by the way, I agree. The dispatch over 13 subclasses mess > "patterns" introduce is just spagetthi programming with a big > name. (Not to disparage pattern, but making something OO doesn't make > it modular or structured per se). What about 13 generic packages? >> You could also sort same elements of same container object using >> different orders. [However usually in such cases one better uses a >> sorted view, rather than physically sorts. > > That you can do, but I still could just sort accesses to the > elements. Withou the OO mess. 1. It is not a generic solution. 2. Elements must be aliased, which changes the container type. 3. You can do that with OO. Class-wide (OO), generic, functional are orthogonal approaches which can be mixed in different proportions. In a proper type system they all will converge because both generics and procedures will become proper types and values. I fail to see the reason why this so irritates you. >>> Yes. But Georg used generics, so it worked. You said, you don't want >>> generics, but it doesn't work. I fail to see, how George has to use >>> select an example that makes your misguided hypothesis -- that >>> generics are not neeeded -- hold up. Quite the opposite. > > >> generic >> type Element is private; >> with function "<" (Left, Right : Element) return Boolean; >> with function "=" (Left, Right : Element) return Boolean; >> type Container ... >> procedure Quick_Sort (...); > >> How can this can sort the same container? > > Which "same container"? Of the same type and the same object. >> This is a clear case where generics don't work. > > Have you recently had a look to Ada.Containers? There is a generic array sort. So? What is generic there? How polymorphism of comparison is achieved. Statically, dynamically, ad-hoc? >> You need "<" and "=" be passed as proper functions >> rather than formal generic functions. [It is not static polymorphism >> anymore.] > > And, what is the problem with that. That it is not generic. You cannot call a car solar just because you carry wrist-watch with solar cells while driving it... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de