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,198c6302c4a0b0d7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-19 10:20:43 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!rockie.attcanada.net!newsfeed.attcanada.net!204.127.161.4!wn4feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc54.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3c1dc786@pull.gecm.com> <1008601517.470745@edh3> <1008626816.690418@master.nyc.kbcfp.com> <1008690461.380980@master.nyc.kbcfp.com> <_xRT7.4398$xl6.682759@rwcrnsc54> Subject: Re: was Re: Ada / C++ comparison paper anymore X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <_T4U7.8960$xl6.990924@rwcrnsc54> Date: Wed, 19 Dec 2001 18:20:42 GMT NNTP-Posting-Host: 204.127.202.212 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1008786042 204.127.202.212 (Wed, 19 Dec 2001 18:20:42 GMT) NNTP-Posting-Date: Wed, 19 Dec 2001 18:20:42 GMT Organization: AT&T Broadband Xref: archiver1.google.com comp.lang.ada:18107 Date: 2001-12-19T18:20:42+00:00 List-Id: (gee I wonder what happened to the Subject: line... looks like I slipped with the "paste" shortcut :-) "Brian Rogoff" 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" 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