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: a07f3367d7,da85d9aaf769b16a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Generic package parameters not externally visible : what's the rational ? 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: <10eygvuzeit9g.xwy2wanxoxgf$.dlg@40tude.net> <1kf8mo4r9lqxg.1tdhqe6femt9m.dlg@40tude.net> Date: Fri, 30 Oct 2009 20:32:12 +0100 Message-ID: <1r8etjwa9k46n.3pyj04jn686o$.dlg@40tude.net> NNTP-Posting-Date: 30 Oct 2009 20:32:13 CET NNTP-Posting-Host: 0bc25ea0.newsspool2.arcor-online.net X-Trace: DXC=Sf@[]?m1l`L78PK[oJ2ng@A9EHlD;3YcB4Fo<]lROoRA8kF On Fri, 30 Oct 2009 06:25:21 -0400, Stephen Leake wrote: > "Dmitry A. Kazakov" writes: > >> My take is that any generic code is potentially broken. Anyone who uses >> generics beyond very trivial cases should know that, and mentally prepare >> himself to fix his code over and over again. > > That is certainly not my experience. I use generics extensively; it's > one of the best features of the language. Do you use generic in other generics? How does look the hierarchy matrix of? This requires a bit explanation. A set of generics sharing some common parameter (like the number type in a generic matrix package) are kind of class, i.e. they declare sets of types dependant on the parameter (like vector, matrix etc). I call this almost "trivial". Non-trivial it becomes when you have several such axes. Here is an example of a mesh of generic packages with 4 axes: http://www.dmitry-kazakov.de/ada/fuzzy.htm#8 Note that semantically the example is quite simple, almost evident. Its implementation and use is horrific. I would never consider it "fixed". As for being the "best language feature", I hope that you would easily find lots of more useful and advanced Ada features. What about unconstrained types? User-defined numeric types? Packages (vs. types) as encapsulation modules? If any of these were removed it would not be Ada. On the contrary, Ada without generics sounds quite plausible to me. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de