Subject: Re: Prolog vs. Lisp
From: Erik Naggum <erik@naggum.no>
Date: 1997/04/02
Newsgroups: comp.ai,comp.lang.prolog,comp.lang.lisp
Message-ID: <3068978379837591@naggum.no>


* Susan Fisher RSTC Contractor
| I have a similar question.  I am taking an AI course where we may program
| in any language we choose.  I debating the use of C, C++, and LISP.  I am
| looking for any insight on the pros and cons of these languages.  I am a
| very new programmer and have honestly never had the option of which
| language to use!  And advice would be greatly appreciated.

rest assured that someone will come along and proclaim Lisp dead or that
they can't use it.  this is really only a reflection of their own attitude,
_possibly_ only envy for those who can still use it for fun and profit, and
has nothing to do with the language.  you will find similar "reasons" not
to use any other language, too.  Common Lisp was approved as ANSI Standard
on 1994-12-08.  the vendors in the Lisp market are growing.

C is very close the actual processor, which means you get to do everything
yourself.  while the model of the processor that C employs is long gone,
the simplicity of the model still makes is possible to be fairly certain of
how the machine will respond to your instructions.  this gives programmers
a feeling of "control" that is very intoxicating.  it is also easy to
confuse this "control" with "efficiency", but computers are not efficient
in intuitive ways, in fact haven't been for years.  C is used to implement
operating systems and fundamental parts of many other languages, and is an
invaluable language to know in today's market.  C was approved as ANSI
standard on 1989-12-14.  it is possible to learn C well in about 2 months,
and it is simple enough to become an expert in about a year.  (I have
programmed in C for 15 years.)

C++ tries very hard to be an object-oriented language, but doesn't quite
make it.  C++ is an extremely complex language, as evidenced by the draft
ISO standard.  the syntax is so complex that common tools to parse and
process programming languages fail to handle C++.  the precise meaning of
several of its constructs is still open to debate, and several vendors who
have produced large C++ systems still disagree profoundly on what they
mean.  C++ leaves a lot to the implementation for the same reason C does,
but that reason was valid for C.  the previous draft standard was rejected
by the international programming language community, as being grossly
inadequate for an international standard.  it is unlikely that C++ will
reach standard status for several years, still.  even if it does become a
standard, the vendors in the C++ market are not known for their willingness
to follow standards in the first place, and some even make a point of doing
weird things that lock you into their environment.  the creator of C++,
quote a Bell Labs proverd that "language design is library design", so you
improve the C++ system to meet your needs by adding new objects and new
functions for them, but you cannot expand on existing objects.  it is
possible to learn C++ well in about 18 months, but it takes several years
to become, and constant vigilance to remain, an expert, since the language
is still in flux.  (I programmed in C++ for about a year (less than it took
to learn it well, which is why I quit -- life is too long to know C++
well), but still help others understand C++ concepts by relating to other
languages (typically C and Lisp) where the concepts are much better
expressed.)

Common Lisp is object-oriented all the way.  the data types in Common Lisp
form a hierarchy, instead of being all distinct.  objects are typed, but
variables are not.  (in C/C++, all objects are just so many bits, their
meaning depending on how you view them.  this is "the hardware way".)  this
type hierarchy means that polymorphism and all that fine stuff works for
built-in types.  object-orientation in Common Lisp is based in generic
functions that take arguments of any type, and for which methods are
specialized on the types of any number of the arguments.  Common Lisp has a
large number of built-in types and operators, but you don't need to know
them all.  the difference between a new and an experienced Common Lisp
programmer is not as much in how much of the built-in facilities they use,
but in how the experience programmer builds the language "upwards" to his
problem so it is easier to express himself.  this was the real intention
behind object-oriented languages (as expressed in the early papers on
Simula, the first object-oriented programming language), but as long as
only objects and functions can be built by the programmer, not language
constructs, it doesn't really work all that well.  Common Lisp is one of
very few languages that allow the programmer to define application-oriented
languages.  it is possible to learn Common Lisp well in about a month, but
to master it takes many years and is a constant source of enjoyment to
learn even more elegant ways to do things.  (I first met Lisp in 1978 or
so, always returning to its concepts while programming in other languages.
I have programmed in Common Lisp for real for nearly four years, now.  I
couldn't earlier, mostly because Common Lisp environments were too
demanding of the hardware I could use, but this has changed, today, it's
C++ and the like that are too demanding for commonly deployed hardware.)

I envy you the opportunity to study Lisp and C and C++ with fresh eyes.

#\Erik
-- 
I'm no longer young enough to know everything.