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!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!feeder2.cambrium.nl!feed.tweaknews.nl!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: default formal parameters in generic declarations References: <9b3bac4d-5ae1-4a1b-a81e-9aa9ae1843e0@e31g2000hse.googlegroups.com> <0078161e-64c7-4fa8-9794-b840d855a88b@q78g2000hsh.googlegroups.com> <47cfba2a$0$14412$9b4e6d93@newsspool3.arcor-online.net> <8c4ddd97-42ab-454f-9ca4-89bf23e15fa0@b1g2000hsg.googlegroups.com> Date: Thu, 06 Mar 2008 23:41:19 +0100 Message-ID: <87lk4vv5kg.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:qdHMd1TCqXObwuLEsMzW/3+QY6M= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tele2 X-Trace: DXC=hECC>9Fh8VhYk0UJ3UlSOn6`Y6aWje^Yj4ggT9B6cbJom@[o=d]MiOm3b=PQoj6;9fM`A9B80D9;` Xref: g2news1.google.com comp.lang.ada:20208 Date: 2008-03-06T23:41:19+01:00 List-Id: Eric Hughes writes: > On Mar 6, 2:32 am, Georg Bauhaus wrote: >> By way of speculation, can nesting, to the extent it is absent from C++, >> lead to at least a partial solution of this problem? > [example deleted] > > The technique you outlined is applicable insofar as name space > manipulation goes, yes. I note here that your example uses a formal > default subprogram. > > The problem, really, is that an aspect is larger than a single > function. An aspect has state, a state that augments the state of the > package for which it is an aspect. State, in Ada, is captured in > types. For example, a null aspect has no state, represented by a null > record. Ada currently has neither formal defaults for types or > packages; I've been focusing on packages. If Ada had a syntax for a > formal default type, I might be able to shoehorn everything through > that, at the cost of some contortion of syntax, but that's not > possible either. The actual subprogram may very well be nested in a package that declares all the necessary types and variables to keep the state. And, in Ada 2005, it is even possible to pass a null access-to-subprogram as the formal to represent a "null aspect". -- Ludovic Brenta.