From: Preben Randhol <randhol+abuse@pvv.org>
Subject: Re: Generic default parameters
Date: Sat, 11 May 2002 12:32:54 +0000 (UTC)
Date: 2002-05-11T12:32:54+00:00 [thread overview]
Message-ID: <slrnadq3rn.1cf.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: udo7pacp4cmkfe@corp.supernews.com
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
next prev parent reply other threads:[~2002-05-11 12:32 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
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 [this message]
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