Is this a true statement: Part III

Alex Martelli aleaxit at yahoo.com
Tue Jul 3 17:36:59 EDT 2001


"Courageous" <jkraska1 at san.rr.com> wrote in message
news:fnt3ktkphaut5q2ohbpage1n1advhdt109 at 4ax.com...
>
> >The thing that I found interesting about the Part II posts were the
positive
> >things said about the C language.  Is C that much different than C++?
Why
> >the leaning towards C over C++?
>
> The explosion of forms available and commonly in use in C++ gives me
> a headache. I really just want "C with classes and virtual functions,"
pretty
> much. Templates are an abortion.

Templates are by far the best group of features in C++.  See, for
example, www.boost.org to see what excellent, solid, *FAST* libraries
they let experts brew.  But then, the standard C++ library (and most
specifically the part of it that was inspired from STL, and also SGI's
ongoing STL work) and Coplien's "pattern without a name" (and its
use e.g. in ATL/WTL) should have proven that already.  Generic
programming is an extremely important paradigm and templates
support it quite creditably.

Besides, template programming means signature-based polymorphism,
just like Python programming.  The analogies between coding C++
templates and coding Python are amazingly strong -- I was able to
"dream in Python" MUCH faster because of strong previous experience
with C++ templates.  Of course, in C++ the polymorphism in templates
has to be solved at compile/link time, giving more speed than the
Python runtime resolution but less flexibility.  But the way you use
it in practice is VERY close in either case.


> The reference operator is often used
> in lieu of a perfectly good pointer, and when it is, it's badly
obfuscating.

There is no such thing as a "reference operator".  If you mean
a reference parameter, yep -- they were originally meant for
overloaded operators, and using them in methods or functions
that are not operators may be confusing and misleading to
somebody coming from C -- not to somebody coming from Pascal,
or Visual Basic, or, I believe Ada, or Eiffel, for example -- of course,
because those languages would have made them used to
distinction between by-value and by-ref parameters being
designated at the called-function declaration point, just
like is done with C++'s reference-parameters.

But if you think Pascal, VB, Ada, Eiffel and C++ are all "abortions",
because they distinguish val/ref parameters elsewhere than C
does, you're perfectly welcome to this opinion, of course:-).


Alex






More information about the Python-list mailing list