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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,43f6bd9b498b66d0 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!out02a.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!uns-out.usenetserver.com!news.usenetserver.com!pc03.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: default formal parameters in generic declarations References: <9b3bac4d-5ae1-4a1b-a81e-9aa9ae1843e0@e31g2000hse.googlegroups.com> <412874f9-9ddb-4aea-ac45-b366b0b1e68a@u10g2000prn.googlegroups.com> From: Stephen Leake Date: Wed, 05 Mar 2008 08:11:31 -0500 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/22.1 (windows-nt) Cancel-Lock: sha1:s86flR4m7hMuD9mF1kqKiA6dq50= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: c5f4647ce9995e05e48ed23862 Xref: g2news1.google.com comp.lang.ada:20186 Date: 2008-03-05T08:11:31-05:00 List-Id: Eric Hughes writes: > Eric Hughes writes: >> I would like to implement this in Ada, but the absence of a default >> package parameter means that instantiation is horribly clunky and that >> only the most dedicated would use it. > > On Mar 3, 5:42 am, Stephen Leake > wrote: >> I don't see why this would be "horribly klunky"; they typical user >> will do: > > For a single package instantiation, a default formal package would > have the same benefit as a default formal subprogram. It removes from > a programmer's mind a detail that may not be relevant, and it removes > from a less-experienced such mind a barrier to entry. Right. > I said "horribly klunky" specifically in reference to instantiation of > aspects. The problem arises because, in general, an aspect _ought_ to > have access to the internal state of the package for which it is > acting as an aspect. Right. That's one reason I don't think aspect-based programming is all that useful. > That means that a base package requires an aspect parameter to > instantiate it at the same time as the aspect requires a base > package to instantiate it. The hard problem I had to figure out was > how to avoid infinite regression. Ok. > In C++, the solution was to rely upon a detail of template > instantiation where a self- reference to a class itself with the > template parameters of its instantiation refers _not_ to the > templated base class but to the class being instantiated, and so > thus creates (de facto) an anonymous type whose introduction breaks > the regression. Ok. Did you find a similar mechanism in Ada yet? Does limited with help? > If that sounds complicated to understand, it is. The minimal syntax > to declare and to instantiate is not simple. In fact, it's really > quite a mess, and I couldn't figure out how to simplify it (even more-- > I have some idea that it's minimal). Requiring an ordinary user to > learn even some this detail simply to use the class in its ordinary > way is a poor information-hiding practice. Ok. I can see that this might justify "horribly klunky". -- -- Stephe