Re: is LISP the ultimate prgram language?
On Oct 20, 1:48 pm, r...@zedat.fu-berlin.de (Stefan Ram) wrote:
James Kanze <james.ka...@gmail.com> writes:
C++ wants to be an =BBobject oriented programming language=AB
No it doesn't. C++ wants to be a multi-paradigm programming
langauge, supporting many different paradigms, including
object oriented programming.
C++ started out as =BBC with classes=AB, so, initially,
classes were seen to be the main raison d'=EAtre for C++.
A desire to support object oriented programming is certainly one
of the motivations for using C++, rather than e.g. C. Object
oriented programming is a useful paradigm, and it's rare that I
don't use it for some parts of my application. *For* *some*
*parts*. The advantage of using C++ is that I don't have to
switch languages when other paradigms are more appropriate. Or
force my design into a paradigm that isn't appropriate. Or fake
it somehow (like java.lang.Math), pretending to be OO when I'm
not.
Many (not all) of the criticisms of it come from people who
insist that only one paradigm is good, and are upset with C++
because it doesn't impose that paradigm.
Ignoring other paradigms, C++ does not support
object-oriented programming well even when it is viewed in
isolation.
It supports it "sufficiently".
It misses:
- =BBEverything is an object=AB
Which is an advantage. Some things aren't objects, and
shouldn't be considered such.
- In C++, there is no support for most literals
as objects:
- =BB2=AB is not an object
- =BB"abc"=AB is not an object
Define "object". According to the standard, both are objects.
I assume that you mean something more, however, but what
exactly? And depending on your answer, maybe 2 or "abc"
shouldn't be objects. (They certainly shouldn't be polymorphic,
nor have identity.)
- In C++, there is no support for several kinds
of data as objects (numbers are not objects,
booleans are not objects)
Again, depending on your definition of object, maybe they
shouldn't be.
- In C++, there is no support for code blocks
as objects:
- =BB{ o.f(); }=AB is not an object
Not yet:-).
- Dynamics
- In object-oriented programming, most is done
as late as possible at run time (like message
dispatching) - the C++ standard library tries
to do as much as possible as early as possible
(at compile time; template instantiation).
That really depends on your definition of object oriented
programming. C++ leaves it up to you to define when you want
late dispatch. In a controlled (type verified) manner. Which
for most uses is superior to uncontrolled dynamism a la Lisp:
errors at compile time are far better than the program failing
in the field. (Note that even an expert like Meyer insists on
static type checking.)
--
James Kanze