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-11 05:32:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.net.uni-c.dk!uninett.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: Generic default parameters Date: Sat, 11 May 2002 12:32:54 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: NNTP-Posting-Host: kiuk0156.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1021120374 25429 129.241.83.82 (11 May 2002 12:32:54 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Sat, 11 May 2002 12:32:54 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:23894 Date: 2002-05-11T12:32:54+00:00 List-Id: On Fri, 10 May 2002 14:27:39 -0500, Randy Brukardt wrote: > > The point of course is to provide defaults for some (not all) > parameters, so the "package" you're talking about would have to be > generic. > > The case that brought this up is something like: > > generic > type Element_Type is private; > type Count_Type is (<>) use Natural; > package Lists is ... > > Generally, the default Count type is sufficient. But there may be > occassions where some user-defined type would be valuable. A typical > instantiation would look like: > > package My_List is new Element (Some_Record); ^^^^^^^ Lists ? > To get that with a package, you'd have to have a generic package > wrapper: > > generic > type Element_Type is private; > package List_with_Natural_Count is > package List is new Lists (Element_Type, Natural); > end List_with_Natural_Count; > > and then you would have complications in naming the items in the > instantiation (especially if you do not want to use a "use clause" on > the package). The net effect (either way) is to make it harder to > create a general component that is also relatively easy to use. OK I see. -- "Jeg tror nordmenn har glemt hvordan de tilbreder fisk. De er mest opptatt av firkantet fisk." -- Kristian Kristiansen, yrkesfisker, aftenposten.no 19/04/02