Python is just as good as C++ for real apps

Greg Weeks weeks at vitus.scs.agilent.com
Fri Jan 25 04:19:58 CET 2002


Jason Orendorff (jason at jorendorff.com) wrote:
: Greg Weeks wrote:
: > In C programming, given some particular conceptual data type, you will
: > often find in the code both a structure type and a 
: > pointer-to-structure type.  As you read the code, you will find
: > the pointer-to-structure type actually being used.  The *only* need
: > for the structure type is to allocate objects on the execution stack
: > rather than on the heap.

: That's not true.  The structure type is also used in arrays and in
: other structures, whether on the stack or not.

Yes, but pointer-to-structures could be used in their place, except for
the issue of performance.  This assumes -- well, see below.


: I think this is, at least, a misunderstanding of Bjarne Stroustrup's
: point of view.  Stroustrup sees support for "concrete types" - that is,
: classes with value semantics, not intended to be subclassed - as an
: important feature of C++.

I'm a bit lost here.  I don't see why "value semantics" -- which I
interpret to refer to immutables, like complex numbers or geometric points
or immutable strings -- precludes subclassing.

Anyway, complex numbers and geometric points and such can be represented by
by pointer-to-structure types.  The programmer can prevent the objects from
being mutated after they are created and can define equality to be the
equality of parts.  Java and Python allow only this.  C++ provides more.
If Stroustrup believes that this additional expressiveness is worth the
added complexity, I'm disappointed.

Greg



More information about the Python-list mailing list