comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+abuse@pvv.org>
Subject: Re: Generic default parameters
Date: Sat, 11 May 2002 12:28:21 +0000 (UTC)
Date: 2002-05-11T12:28:21+00:00	[thread overview]
Message-ID: <slrnadq3j5.1cf.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: abgtpe$qlt$1@nh.pace.co.uk

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
-- 



  parent reply	other threads:[~2002-05-11 12:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-10 14:22 Generic default parameters Thomas Wolf
2002-05-10 16:38 ` Preben Randhol
2002-05-10 16:50   ` Marin David Condic
2002-05-11  9:29     ` Simon Wright
2002-05-13 15:03       ` Hyman Rosen
2002-05-11 12:28     ` Preben Randhol [this message]
2002-05-13 14:03       ` Marin David Condic
2002-05-13 14:49       ` Hyman Rosen
2002-05-10 19:04   ` Hyman Rosen
2002-05-11 12:23     ` Preben Randhol
2002-05-11 13:49       ` Larry Kilgallen
2002-05-13 14:06       ` Marin David Condic
2002-05-10 19:27   ` Randy Brukardt
2002-05-11 12:32     ` Preben Randhol
2002-05-10 22:14 ` Stephen Leake
2002-05-13  7:49   ` Thomas Wolf
2002-05-13  8:49 ` Dmitry A. Kazakov
2002-05-13 14:00   ` Stephen Leake
2002-05-13 15:21     ` Dmitry A. Kazakov
2002-05-13 16:42       ` Stephen Leake
2002-05-14 10:24         ` Dmitry A. Kazakov
2002-05-14 14:02           ` Stephen Leake
2002-05-15 10:08             ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
2002-05-14  4:57 Grein, Christoph
2002-05-14 10:23 ` Dmitry A. Kazakov
2002-05-14 11:03 Grein, Christoph
2002-05-14 12:01 ` Dmitry A. Kazakov
2002-05-14 14:05   ` Stephen Leake
2002-05-15  8:44     ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox