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.2 required=5.0 tests=BAYES_00,PLING_QUERY, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b6d862eabdeb1fc4 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news4.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.158.31.10.MISMATCH!newsfeed-0.progon.net!progon.net!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada noob here! Is Ada widely used? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <0e88de66-128c-48fd-9b9f-fdb4357f318a@z17g2000vbd.googlegroups.com> Date: Sun, 6 Jun 2010 13:45:48 +0200 Message-ID: <2o8vq76hpv1m.vs7m2beo23nz.dlg@40tude.net> NNTP-Posting-Date: 06 Jun 2010 13:45:48 CEST NNTP-Posting-Host: cb3e39d3.newsspool1.arcor-online.net X-Trace: DXC=:3cc83M7ma2]E=H1Q9`787ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2[OgT3@U=9b>[6LHn;2LCV>[ On Sun, 06 Jun 2010 13:06:45 +0200, Yannick Duchêne (Hibou57) wrote: > Le Sun, 06 Jun 2010 11:22:07 +0200, Dmitry A. Kazakov > a écrit: >> But if you force yourself to instantiate earlier, you get a very fragile > Don't see a reason why ; and this even seems contradictory to me: the > earlier you instantiate, the less complex it is. Or not ? Less complex and more fragile, because of premature decisions to meet. The package Generic_Complex_Types requires the type Real to instantiate. You have to define this type, range, precision etc. Later on, if the choice might appear wrong, you will have a huge problem, if the instance is widely used. A typical solution is to pass the instance as a parameter of another generics. Welcome to the Hell... > An example objection could be, when a generic is used, > other ways may have been evaluated and excluded for some reasons. Right, just like gotos. > Or is > Ada missing something so that people don't have any other choice than > generic (generic as a fall-back) ? What could this other paradigm could > looks like then ? Dynamic polymorphism, abstract types, interface inheritance, constraining (discriminants), static functions. > In the area of other choices, would automatic generation or simply copy be > a better choice (as this is one of the cases generics avoid) ? I feel it > would be even less usable. Probably yes. Macro is a macro, even if you call it generics or template. >> Add here that generics are non-testable. You can test instances, you >> cannot generics. Then Ada has been drifting towards C++ in the sense >> what promises gives you a successful compilation of the generic >> body, little, very little, nothing... > (another matter this one) > This is not like if generics could be instantiated with anything. > Actually, this is not: you can require a formal parameter to be a discrete > type, to be derived from another type, etc. Yes. The language of generics regarding its formal parameters: C++: untyped Ada: typed, types are built-in, no abstract/user types whatsoever Must-be: ADT + OO ... too much work to invest into a meta language. Why not to concentrate on the object language, i.e. on the core Ada type system? > So some assertions can be made > on the validity of a generic's logic and implementation. Some, but as I said Ada drifts towards less checks. You can (and will) get errors upon instantiation even if actual parameters match the formals! > Perhaps you are > requesting for more ways to constrain formal parameters ? (I would agree > with you, unless SPARK already support generics, which I have still not > tested so far). > > Oops, I have implicitly replaced “testable” by “provable”, hope you don't > mind. I do. If you'd make them provable you would need not to test. The problem is that for generics provability is much harder than for the object language. The same question again. Why not to concentrate on the core Ada and integrate SPARK there? To me generics is a dead end. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de