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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f7a9613bbc2bd8c9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-10 15:14:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Generic default parameters Date: 10 May 2002 18:14:25 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1021069249 12622 128.183.220.71 (10 May 2002 22:20:49 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 10 May 2002 22:20:49 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:23872 Date: 2002-05-10T22:20:49+00:00 List-Id: Thomas Wolf writes: > 5. Linked to (3) above: some way to specify a storage pool that > is equal to whatever pool the compiler would use if no > "for Some_Access'Storage_Pool use ..." clause was present, i.e. > a generic way to refer to the standard storage pool of a type > without referring to the type. Something like > > generic > type Something is private; > Pool : in out System.Storage_Pools.Root_Storage_Pool'Class := <>; > package X is > type Some_Access is access all Something; > for Some_Access'Storage_Pool use Pool; > ... > > and if an instantiation provides an actual for 'Pool', that will > be taken as the storage pool of type 'Some_Access', but if an > instantiation doesn't provide an actual, 'Some_Access' will use > a standard storage pool. > > Not sure if point (5) makes sense, especially since it would be > useful only for storage pools, but make no sense at all for other > types... I think a cleaner solution to 5 is a standard name for the standard storage pool, combined with 3 (default object for "in out"). So we'd have: generic type Something is private; Pool : in out System.Storage_Pools.Root_Storage_Pool'Class := System.Storage_Pools.Default_Storage_Pool; package X is type Some_Access is access all Something; for Some_Access'Storage_Pool use Pool; There may have to be more than one default storage pool; that may be why there is no standard name now. > Comments, anyone? Would these things be worth to consider for inclusion > in the next Ada revision? I agree they would all be useful, but I have personally only seen the need for 5 and 3. -- -- Stephe