comp.lang.ada
 help / color / mirror / Atom feed
From: "Mark Lundquist" <mlundquist2@attbi.com>
Subject: Re: Generics not overloadable
Date: Sun, 09 Dec 2001 14:05:09 GMT
Date: 2001-12-09T14:05:09+00:00	[thread overview]
Message-ID: <pcKQ7.19034$wL4.24049@rwcrnsc51> (raw)
In-Reply-To: 5ee5b646.0111281941.2620b70a@posting.google.com


"Robert Dewar" <dewar@gnat.com> wrote in message
news:5ee5b646.0111281941.2620b70a@posting.google.com...
> Ted Dennison<dennison@telepath.com> wrote in message
news:<VGcN7.41331$xS6.69936@www.newsranger.com>...
>
> > It annoyed me too when I discovered it
>
> I find it hard to believe that it would be easy to come
> up with an example where it would help the reader to
> name two visible generic units with the same name.

Why should it make a difference whether they are generic?  The principle is
the same.  As for examples, just about anything will do, but here's one
(self-explanatory, I trust)...

    generic
        with procedure Action (On : Item);
    procedure Apply (Over : Collection);

    generic
        with procedure Action (On : Item; Continue : out Boolean);
    procedure Apply (Over : Collection);

    generic
        with procedure Action (On : Item);
    procedure Apply (Start, Finish : in Iterator);

    generic
        with procedure Action (On : Item; Continue : out Boolean);
    procedure Apply (Start, Finish : in Iterator);

The user should not have to remember a different fiddly specialized name for
each variant.   It's much more natural, and easier on the user,  if each can
be called simply "Apply".

>
> Indeed, far too often overloading in Ada is misused to
> save the bother of thinking of different names.

Maybe so, but not by me :-).  I take naming too seriously, if anything :-).
Incidentally, I realized the reason for the language rule that makes it
impossible to overload generics.  The wonderful benefit :-) is that I can
write

    generic
        type Foo is private;
        with procedure Something (Foo : X.Foo);
    package X is
        .
        .

Talk about "saving the bother of thinking of different names"!

I'd gladly trade away this liberty in the generic formal part for the
ability to overload generics.

-- mark










  parent reply	other threads:[~2001-12-09 14:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-28 21:10 Generics not overloadable Mark Lundquist
2001-11-28 21:29 ` Ted Dennison
2001-11-29  3:41   ` Robert Dewar
2001-11-29  5:49     ` R. Tim Coslet
2001-12-09 14:05     ` Mark Lundquist [this message]
2001-12-10 16:15       ` Stephen Leake
2001-11-29 10:41 ` Ian Wild
2001-11-29 19:10   ` Mark Lundquist
2001-11-30 22:38     ` Nick Roberts
  -- strict thread matches above, loose matches on Subject: below --
2001-11-28 17:44 Mark Lundquist
replies disabled

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