Re: What has C++ become?
On Jun 3, 5:39 pm, Noah Roberts <u...@example.net> wrote:
James Kanze wrote:
On Jun 2, 7:27 pm, rpbg...@yahoo.com (Roland Pibinger) wrote:
On Sun, 1 Jun 2008 16:34:58 -0700 (PDT), plenty...@yahoo.com wrote:
I recall having the same experience, the *first* time I
looked at a C program, having before that seen only Pascal,
Modula-2, Basic and assembly. But I've seen C++ many times
now, albeit mostly my own which is deliberately readable.
You can safely ignore this geek style 'template programming'
because it will never reach the mundane area of real-world
programming.
First, you can't ignore anything, because you never know where
it will crop up. And like most things, it will be more or less
readable, depending on who wrote it.
What is true is that at the application level, there is very
little need for meta-programming; it is mostly used in low level
libraries (like the standard library).
Well, first of all, I don't think that the standard library, where it
actually makes use of generic/meta programming techniques, is "low
level". It is very much application level - stacks, lists,
vectors...this isn't hardware talking stuff.
It's not talking to the hardware, but it is still very low
level. A vector is not (usually) an application level
abstraction, but rather a tool used in application level
abstractions.
There is nothing low level about abstract data types. It is
exactly the opposite of low level in my opinion.
It's about the lowest level you can get. What's below it?
Second, I disagree that there's little need for it in the
application level programming. We, where I work, actually use
it a moderate amount and to great advantage. For instance, we
are an engineering firm and use a data type that uses
metaprogramming techniques to provide type safe dimensional
analysis. Since adopting this it has already saved us
numerous man hours in debugging.
But is the meta-programming in the application itself, or in the
lower level tools you use to implement it? (Not that I would
expect much metaprogramming in type safe dimensional analysis.)
We use boost::units and some other stuff that I wrote on top
of it. Other areas it is used is in a variety of generic
functions that use enable_if to choose or disqualify template
instantiations.
So as one that is not afraid of TMP and uses it *in the
application layer* I really have to disagree with those
claiming it has no place there.
You can't really use templates too much in the application layer
anyway, because of the coupling they induce (unless all of your
compilers support export). And the whole point about being the
application level is that it is specific to the application;
it's not generic. What makes code the application level is that
it deals with concrete abstractions, like ClientOrder or
BookingInstruction (currently) or IPAddress (where I was
before). Just the opposite of template based generics.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34