Re: ADA Popularity Discussion Request

From: Georg Bauhaus (sb463ba_at_l1-hrz.uni-duisburg.de)
Date: 08/28/04


Date: Sat, 28 Aug 2004 18:07:12 +0000 (UTC)

Kevin Cline <kevin.cline@gmail.com> wrote:
: Hyman Rosen <hyrosen@mail.com> wrote in message news:<1093634083.931713@master.nyc.kbcfp.com>...
:>
:> No fair picking an easy one. Suppose you have a vector of complex numbers and
:> want to set the real part of each to zero. That's far from a one liner in C++
:> even though it's conceptually trivial.
 
: With boost::lambda, it would be a one liner:
: for_each(v.begin(), v.end(), _1.r = 0);

With Ada 200Y there is
"procedure Set_Re (X : in out Complex_Vector; Re : in Real_Vector);
procedure Set_Im (X : in out Complex_Vector; Im : in Real_Vector);

Each procedure replaces the specified (cartesian) component of each of
the components of X by the value of the matching component of Re or Im;
the other (cartesian) component of each of the components is unchanged.
Constraint_Error is raised if X'Length is not equal to
Re'Length or Im'Length."

I think no one will deny that there is power in C++ template
computing, and in CLOS makros etc. (Hey, lambda is cool!)
How many specials like _1, embedded languages, and coding conventions
are desirable?
When does code suffer from abbreviation?
What about compiler error messages involving deeply nested template
instantiations?

When people complain about explicit instantiations, for example about
the necessity to express their choices of characteristics of a Booch
Collection using three explicit instantiations, what is the complaint
about?
I think that once you have understood the model, and have learned
to appreciate the why and how, it is no longer an issue.
So the complaint might be about
- the need to understand the model.
- the need to be explicit.
- the need to choose rather than relying on an implicit default.
- the need to type rather than having a number of thoughts be
  condensed in very few characters.
- ...

Hm. Why do they still write "for_each(v.begin(), v.end," so
frequently? :-)

-- Georg