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,f135b0b2991e6686 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!news.doubleslash.org!open-news-network.org!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: C++0x : no 'concepts' 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: <0157a9fd-a1b2-473d-bc85-f84911720520@o41g2000yqb.googlegroups.com> <4aa79ba6$0$32663$9b4e6d93@newsspool2.arcor-online.net> <1myjt3v3dwqj3.1t8nncvu2ty3l$.dlg@40tude.net> <4aa7c007$0$30230$9b4e6d93@newsspool1.arcor-online.net> Date: Wed, 9 Sep 2009 17:42:22 +0200 Message-ID: <1hva3l5mqlw0i$.ia3ssy3z8uva$.dlg@40tude.net> NNTP-Posting-Date: 09 Sep 2009 17:42:22 CEST NNTP-Posting-Host: d2e36c63.newsspool4.arcor-online.net X-Trace: DXC=7A>MPM]1caYaAeROF2PWMQ4IUK<3[DNcfSJ;bb[UFCTGGVUmh?TLK[5LiR>kgR;j8`CNJF_l] X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8255 Date: 2009-09-09T17:42:22+02:00 List-Id: On Wed, 09 Sep 2009 16:47:34 +0200, Georg Bauhaus wrote: > Dmitry A. Kazakov schrieb: > >>> Fantasizing, could we have, in Ada, >>> >>> - recursive instantiations of pure generics? >> >> Huh, the second edition of interfaces, now for the "Ada preprocessor"? I >> read you that all instances of the same body when instantiated >> automatically will be considered "same". Right? > > No, I was thinking of this: > > generic > N : Natural := (if N = 0 > then 1 > else new Factorial'(N * Factorial(N - 1))); > function Factorial return Positive; > > pragma Pure(Factorial); I see, PL/1's preprocessor: %DO I=0 TO 255; ... -- I don't remember the mess %END; Shudder. ---------------- What I meant was rather: generic type Number is digit <>; with package Arithmetic is new Generic_Arithmetic (T); package Generic_Vectors is ... when Generic_Vectors is instantiated with Float it instantiates Generic_Arithmetic as necessary. This is instead of putting an instantiation into Generic_Vectors's declarative part because we want to share the same instance of Generic_Arithmetic with other generic packages instantiated with Float. Typically you have a cloud of generic packages started with a priming type like Float. It is a torture to instantiate them manually, inventing a naming scheme for them, and then dealing with 1K source files resulting from. The disaster is aggravated by instantiations within generic packages. In the end nobody knows why the program does not compile and what is instantiated where. The problem with automatic instantiation is that when instances have data/elaboration code etc, it will be a hell to tell if two instances are same or not. The situation is identical to MI. In fact it is a form of MI, just based on the static polymorphism. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de