comp.lang.ada
 help / color / mirror / Atom feed
From: "Mark Lundquist" <no.spam@getalife.com>
Subject: Re: was Re: Ada / C++ comparison paper anymore
Date: Wed, 19 Dec 2001 18:20:42 GMT
Date: 2001-12-19T18:20:42+00:00	[thread overview]
Message-ID: <_T4U7.8960$xl6.990924@rwcrnsc54> (raw)
In-Reply-To: Pine.BSF.4.40.0112190135400.32168-100000@bpr.best.vwh.net


(gee I wonder what happened to the Subject: line... looks like I slipped
with the "paste" shortcut :-)

"Brian Rogoff" <bpr@bpr.best.vwh.net> wrote in message
news:Pine.BSF.4.40.0112190135400.32168-100000@bpr.best.vwh.net...
> On Wed, 19 Dec 2001, Mark Lundquist wrote:
> > "Brian Rogoff" <bpr@bpr.best.vwh.net> wrote in message
> > news:Pine.BSF.4.40.0112181924260.32168-100000@bpr.best.vwh.net...
> >
> > > I have made the point many
> > > times that I think some amount of inference/automatic instantiation,
like
> > > what C++ has, would be a great thing in an Ada like language.
> >
> > Yes.
>
> It's good to know that at least *one* more Ada fan likes this capability.

For generic subprograms, it would be _really_ nice.  I'd like to be able to
write this:

        -- An ordinary generic subprogram
        --
        generic
            type T (<>) is private;
            with function F (X  : T);
        function Thunk return T;
        .
        .
        .
        -- Another ordinary generic subprogram
        --
        generic
            type T (<>) is private;
            with function F return T;
        procedure Do_Something;
        .
        .
        .
        -- a call
        --
        Do_Something (Thunk (Some_Function (Some_Object)));

Note:
    (a) the instantiations are implicit (no "new" required);
    (b) the instantiations are anonymous; and
    (c) the actuals to formal type T are inferred

This is just scratching the surface of what could be done, but you get the
idea... Just to play around with, I wrote a package of generics for
functional programming, including a bunch of Thunks, Predicates and logical
operations on the predicates, and composition and identity functions.  It's
fun, but the syntactic overhead of building up the instantiations for any
call is way too heavy.  Plus I have to use crappy names because generics
aren't overloadable (the subject of another thread).  It could be much
more elegant.

There's a suite of enhancements to generics that I plan to write up as a
proposal... sometime before 2005 :-)

>
> > I might prefer a more longhand shorthand :-), e.g.
> >
> >     X'Increment;                        -- (X names object of integer
type)
> >     X'Increase (By => 1.23);     -- (X names object of any numeric type,
> > here a FP type)
> >     etc...
>
> Well, you can do something pretty close now with a generic package and the
> function call notation.

Been there, done that :-)... but I'd rather they were intrinsic.  In a
revised Ada, I'd still prefer the attribute notation over new operators, but
that's just my own taste...

Cheers,
-- mark

-------------
Reply by email to: Mark dot Lundquist at ACM dot org
Consulting services: http://home.attbi.com/~mlundquist2/consulting








  reply	other threads:[~2001-12-19 18:20 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-17 10:22 Ada / C++ comparison paper Martin Dowie
2001-12-17 14:42 ` Frode Tenneboe
2001-12-17 22:07   ` Hyman Rosen
2001-12-17 22:34     ` David C. Hoos
2001-12-17 22:37     ` Marin David Condic
2001-12-18  0:54       ` Ed Falis
2001-12-18  9:30         ` martin.m.dowie
2001-12-18 14:49           ` Marin David Condic
2001-12-18 17:51           ` Hyman Rosen
2001-12-19 16:10             ` Greg C
2001-12-20 14:41               ` Hyman Rosen
2001-12-20 20:16                 ` Greg C
2001-12-19 20:44             ` Wes Groleau
2001-12-19 20:47               ` Ed Falis
2001-12-20 18:16                 ` Ted Dennison
2001-12-20 19:12                 ` Richard Riehle
2001-12-18  1:16       ` Larry Kilgallen
2001-12-17 22:52     ` Matthew Heaney
2001-12-18 15:47     ` Hyman Rosen
2001-12-18 16:20       ` Pat Rogers
2001-12-18 17:00         ` Hyman Rosen
2001-12-18 17:28           ` Larry Kilgallen
2001-12-18 19:40         ` Brian Rogoff
2001-12-18 20:25           ` Hyman Rosen
2001-12-19  0:53           ` was Re: Ada / C++ comparison paper anymore Mark Lundquist
2001-12-19  1:47             ` Brian Rogoff
2001-12-19 18:20               ` Mark Lundquist [this message]
2001-12-19 19:39                 ` Patrick Hohmeyer
2001-12-19 19:38                   ` Mark Lundquist
2001-12-19 20:51                     ` Patrick Hohmeyer
2001-12-20 17:56                       ` Brian Rogoff
2001-12-20 18:48                         ` Patrick Hohmeyer
2001-12-20 19:20                           ` Brian Rogoff
2001-12-21  3:16                             ` Implicit instantiation (was Re: Ada / C++ comparison paper anymore) Mark Lundquist
2001-12-21  3:12                           ` Implicit instantiation (was Re: was " Mark Lundquist
2001-12-21  2:55                       ` Mark Lundquist
2001-12-20 20:22             ` was Re: Ada / C++ comparison paper anymore Ted Dennison
2001-12-20 20:57               ` Marin David Condic
2001-12-21 17:44               ` Richard Riehle
2001-12-21 17:51                 ` Marin David Condic
2001-12-19 18:20       ` Ada / C++ comparison paper Mark Lundquist
2001-12-20 20:27         ` Ted Dennison
2001-12-20 20:59           ` Marin David Condic
2001-12-21 14:26             ` Ted Dennison
2001-12-21 14:32               ` Marin David Condic
2001-12-21 15:11               ` Jean-Marc Bourguet
2001-12-20 22:30           ` tmoran
2001-12-20 22:36             ` Marin David Condic
2001-12-21 14:23             ` Ted Dennison
2001-12-21 18:46               ` tmoran
2001-12-21 19:09                 ` Ted Dennison
2001-12-21  2:46           ` Mark Lundquist
2001-12-21 14:28             ` Ted Dennison
replies disabled

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