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

Jason Orendorff jason at jorendorff.com
Thu Jan 24 23:11:23 EST 2002


> : 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.

It doesn't (and in C++ you can of course subclass complex<double>
if you feel like it) but subclassing a concrete type isn't
very useful.

Seriously, is there any point in subclassing str?

> Anyway, complex numbers and geometric points and such can be
> represented 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.

I'm sorry to disappoint you!  (C:

One of the explicit goals of C++ was to let the programmer
define types that work just like - and just as quickly as -
built-in types.  (shrug)

## Jason Orendorff    http://www.jorendorff.com/





More information about the Python-list mailing list