-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Brown wrote:
> On Sun, Mar 23, 2008 at 07:20:05PM -0700, Christopher Smith wrote:
> 
>> I fell out of my chair for two reasons:
>> 1) That Mr. Brown feels there is only one way to achieve dynamic
>> dispatch with C++.
> 
> Then you misunderstood me, since I never would have suggested anything like
> that.
> 
>> 2) That Mr. Brown feels all OO programs require dynamic dispatch.
> 
> If I was forced to choose one thing that was necessary to call something
> object oriented, it would have to be dynamic dispatch.  So, feel free to
> stay out of your chair.  How you implement it aside, performing differing
> operations based on the type of objects is what makes something OO.

That is not the same as dynamic dispatch. With statically typed
languages (such as C++, but of course there are a host of others), you
tend to find most programs don't require much dynamic dispatch, and some
programs don't require any at all. The compiler already knows the exact
function which will be needed at compile time.

> I will also be clear that, although I feel C++ is indeed an OO language, it
> is a particularly crappy one.

Indeed. As Stroustrup says, it really is a multi-paradigm language, and
one of its paradigms is OO.

> It gives you some of the useful features of
> OO, and then enough random other things thrown in (plus an unwillingness to
> not be C) to make it the most unpleasant serious language I've ever had to
> write code in.

Never done COBOL, APL, or Ada then (actually I have to admit sometimes
Ada feels nice compared to C++)? Pascal is pretty awful in an Ada--
sense too.

Honestly, the metaprogramming features of C++, as baroque as they are,
often make me feel like it is all worth it, but I'm funny that way.

> I also partially agree with the reference to Alan Kay saying that GC was
> necessary for OO.  Although not strictly necessary, it certainly helps keep
> it from being painful.  Lack of GC is generally a show stopper when I
> choose a language.

I'd almost agree with you there. Certainly having GC makes inheritance
work better, as it reduces the coupling between parent and child classes
(which I feel is a LOT of the reason why deep hierarchies work better in
Smalltalk than in C++, but Java is living proof that GC alone will not
get you all the way).

That said, C++'s destructors and RAII, while making it more painful to
design a class hierarchy, really make it much easier to have resource
management properly encapsulated (one of the most annoying things about
Java and Smalltalk development is how you find yourself constantly
having to explicitly manage almost all non-memory machine resources,
breaking notions of encapsulation... makes me feel like I'm coding in C
again). D and C# take a route that try to hit a resource management
sweet spot better, but I haven't played with either enough to really
feel confident about how well they've succeeded.

When Alan was developing Smalltalk, the VM was the OS, and so the VM
could manage resources automagically pretty well. Additionally, memory
was so tight it was difficult to run out of *other* resources first, so
a lot of these other resource management issues didn't come up, and I
think that gave him a false sense of the coupling/encapsulation trade-offs.

- --Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH6go2OagjPOywMBARAsq7AJ9syog6pNB1kJ880EnRFbhtEqOiPwCgobH0
AQhY0zkcz/eqeGDxW2R8Ddk=
=2ISy
-----END PGP SIGNATURE-----

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to