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?