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:28:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!128.39.3.168!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:28:21 +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 1021120101 25429 129.241.83.82 (11 May 2002 12:28:21 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Sat, 11 May 2002 12:28:21 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:23892 Date: 2002-05-11T12:28:21+00:00 List-Id: On Fri, 10 May 2002 12:50:52 -0400, Marin David Condic wrote: > For the same reason that (in effect) you can have a "default value" > for functions. You say you want a "<" function and with the "is <>" > part you are saying, "But if one is already defined and you don't need > to override it for any reason, then you can save yourself the > effort." > > In your example, this is fine for a generic where you want only one > parameter to default (or all parameters to default). What if you have > 5 parameters and only two of them can sensibly have a default? You > can't pre-instantiate with just the two parameters. (Although this > might pose a solution that requires no new syntax..... Hmmm......) In > the case of Lists, the type of element you're storing should never > default because it doesn't make sense. However the data type of a > returned element count might sanely default to Natural unless the user > has something else in mind. How would you pre-instantiate that with a > default value when you have no default element type? I'm not sure I understand. If you have 5 parameters and only two can have a default then I don't see why giving the generic defaults would help. To me it sounds like making generics less strongly typed/more dynamic, but probably I misunderstand you :-) Preben --