Newsgroups: comp.ai
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!yeshua.marcam.com!zip.eecs.umich.edu!newsxfer.itd.umich.edu!uunet!EU.net!julienas!news.fnet.fr!ilog!puget
From: puget@corvisart.ilog.fr (Jean-Francois Puget)
Subject: Re: C++ as an AI Language (was Re: "AI is a backwater at best")
Message-ID: <1994Aug31.183401.21061@ilog.fr>
Sender: puget@corvisart (Jean-Francois Puget)
Nntp-Posting-Host: corvisart
Organization: ILOG S.A., France
References: <32j1s1$aue@library.erc.clarkson.edu> <CuxywH.CA6@aston.ac.uk> <MAGERMAN.94Aug22173831@snoopy.bbn.com> <push-230894002335@mind.mit.edu>
Date: Wed, 31 Aug 94 18:34:01 GMT
Lines: 93

In article <push-230894002335@mind.mit.edu>, push@mit.edu (Pushpinder Singh) writes:
|> In article <MAGERMAN.94Aug22173831@snoopy.bbn.com>, magerman@bbn.com (David
|> Magerman) wrote:
|> 
|> > In article <CuxywH.CA6@aston.ac.uk> macgremd@aston.ac.uk (MD MACGREGOR) writes:
|> > 
|> >    Are you saying that AI research should be conducted in C++? Surely
|> >    this is too low level. 
|> > 
|> > He may not be saying it, but I am.  Most AI research could easily be
|> > done in C++.  And it'll be even easier once the ANSI standard is
|> > complete and adopted by all the mainstream compilers.  Most people
|> > feel the need to use a language like LISP, since it's got nice objects
|> > predefined as part of the language.  But, once you write the
|> > appropriate objects (or get the appropriate class library),
|> > prototyping in C++ is just as fast as LISP.  And, even better, turn
|> > around time of experiments is usually 10 times faster.
|> 
|> You're joking right?  If the programmer was equally proficient in both
|> languages, I don't see how an experiment could be built faster in C++
|> than in lisp.  The interactive nature of lisp environments alone lets
|> one develop programs many times faster.  What do you mean by "turn around
|> time"?
|> 

I don't think David Magermann was joking since I have similar experience.
My experience comes from the development of a constraint programming tool
(CSP techniques are relevant to A.I., aren't they?) both in Lisp and C++ 
(around 30000 lines of code), called Ilog Solver.

The interactive nature of Lisp is an advantage in that you can incorporate a
minor change of your program very quickly by loading some function 
definitions. With C++ you have to recompile a potentially large part of 
your program.
 
However static type checking done during compilation can detect a lot of 
typos (e.g., wrong number of arguments, missing functions) that are 
discovered at runtime with Lisp. Of course, if you use modules and 
compilation these errors can be detected, but you are back with a 
compilation, as with C++. Moreover, some errors are still not detected 
(e.g. arguments of different types in a wrong order). Thus more changes 
are usually needed to obtain a correctly running Lisp program than a C++ 
one.

I have observed that the time needed to obtain a correctly runnning program
was similar in both cases: a lot of fast changes with Lisp, few slow
compilations with C++.

The big win is when you do some experiments with a correct program. Then 
C++ is more time efficient (I reckon that this is what ""turn around
time" refers to). We experienced an average 3 time improvement 
(not 10). This factor can be much higher if you only use lists as data 
structures.

However, this should not be generalized too quickly. C++ syntax is complex,
and the learning curve is steeper at the beginning than with Lisp. Moreover,
this requires the careful definition of the right object classes and 
memory management. Thus, an occasional programmer will have much more 
rapidly a running software with Lisp. 

|> > Admittedly, I find most existing C++ class libraries wanting (I've
|> > written my own), but once the standard is out and people can depend on
|> > the platform-independence of C++, more people will be programming in
|> > it, and thus better resources will be made available.
|> 
|> I'm hoping for better class libraries myself, but they won't let me
|> build new special forms, or do things like define a set of classes

They won't let you define new special forms since special forms are a Lisp
notion. 

|> on the fly (yes, you do need to do this sometimes to simplify things.)
|> Lisp macros are extremely powerful.  Anyway, let's not turn this into a

You hit a point here : Lisp macros are not matched by any C++ feature. This
is the main thing I miss in C++.

|> Lisp vs C++ debate.  It just seems to me that for AI prototyping and

Lisp vs. C++ is not an interesting debate. For instance, is is possible to
design a Lisp that can easily be connected to C++, refer to C++ objects,
and so on. Some people here have developed such a Lisp, and a paper
describing it is available upon request (send request to davis@ilog.fr).

|> experimentation purposes, LISP can't be beat...

According to you (see above) you have to be equally proficient in both 
languages to be able to make such a claim.


-- 
  Jean-Francois Puget		 net : puget@ilog.fr

