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-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!pe1.news.blueyonder.co.uk!blueyonder!news-out.ntli.net!newsrout1-gui.ntli.net!ntli.net!newspeer1-win.ntli.net!newsfe6-gui.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada) User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <42309456$1@news.broadpark.no> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Fri, 11 Mar 2005 18:01:10 GMT NNTP-Posting-Host: 81.100.88.147 X-Complaints-To: http://www.ntlworld.com/netreport X-Trace: newsfe6-gui.ntli.net 1110564070 81.100.88.147 (Fri, 11 Mar 2005 18:01:10 GMT) NNTP-Posting-Date: Fri, 11 Mar 2005 18:01:10 GMT Organization: ntl Cablemodem News Service Xref: g2news1.google.com comp.lang.ada:9147 comp.lang.c++:45189 comp.realtime:1287 comp.software-eng:4855 Date: 2005-03-11T18:01:10+00:00 List-Id: On Thu, 10 Mar 2005 17:39:13 -0500, REH wrote: > Ada features I would love to have in C++: > * "new types" and sub-ranges Agree strongly. (with compiler-generated checking!) > * runtime template instantiation (I think being able to instantiate > generics dynamically is the coolest thing!) This would be nice! > * subprograms inside subprograms. I think it would be great for use > with the STL (i.e., using a local function with std::foreach) Agree strongly. >* packages. namespaces are nice, but packages make modularity of very > large system a lot easier. Especially now with "use type" Vital! C++ and C suffer a lot from not enforcing encapsulation, allowing headers to break stuff etc. Better control of scope and visibility. Better separation of interface and implementation >* representation specifications!!!! Agree. > C++ features I would to have in Ada: > * Implicit instantiation. Yeah, I know, it can be unsafe, but that is > one thing I really like about C++: the ability to automate repetitive > things. Sometimes useful but is it more than "syntactic sugar"? > * actually having a class object encapulating the data and methods. Yes. It might help if packages were first class objects instead >* reference (in out) types in functions (without resorting to > access types) procedures usually suffice. The "Rosen Trick" works in most cases. I'd like to be able to identify functions as "pure", like in VHDL, and allow the compiler to discard or memoize calls to functions marked as pure. > * meta-templates. very neat stuff. ugly, but neat. I think I prefer Ada generics. I have yet to see how Meta-templates really contribute to a program design. >* The STL!!! (though I hear something similar is coming?) Yes. Agree strongly. ------------------------------------------------------------- My list of Ada features I would love to have in C++ adds: Concurrency. Tasks. Protected objects. Distributed programs. Persistent variables. Eliminate large swathes of the C++ standard which leaves the semantics up to the compiler! Named parameter association. Proper parameter modes "out" and "in out" modes clarity over arrays. C++ gives you choice of pointers C arrays, vectors. This is one example of where the 'C' facilities were too limited, and C++ added alternatives, rather fhan fixing what existed in C. (and char *, char arrays, string etc) Strong(er) typing, better enumerations, fixed point types, modular types *and* non-modular types. Basic type attributes. More robust, more readable, less terse syntax, particularly for complex templates (really!) Portability without resorting to preprocessor directives and conditional compilation -------------------------------------------------------------- My list of C++ features I would love to have in Ada adds: simple and direct interfacing to C/C++ header files - a *big* drawback of Ada :( template specialization extra parameters with "new" -------------------------------------------------------------- But what of features not present in either? Introspection Dynamic compilation/interpretation parallel execution constructs (see Cilk, Occam's "par") coroutines configurations (from VHDL) associative arrays (from Perl) What else? -- Adrian