What can you do in LISP that you can't do in Python

Thomas Bellman bellman at lysator.liu.se
Thu May 17 02:08:08 EDT 2001


Greg Ewing <see at my.signature> writes:

> Thomas Bellman wrote:
 
>> I was talking about parsing the code
>> in order to be able to modify it.  You don't get that for free
>> just because you have the code in a string and the 'execute'
>> procedure takes a string as its argument.

> But Tcl code is represented as lists using the
> standard Tcl conventions for representing lists
> as strings, and Tcl has functions for manipulating
> such lists. So, in principle anyway, it ought to
> be about as easy for Tcl to modify Tcl code as
> for Lisp to modify Lisp code.

For Tcl, that may be true (I don't know enough Tcl to really tell
how easy or difficult it is, so I'll take your word for it), but
that doesn't follow *just*because* you have it in a string, and
can execute that.  It follows because those strings can easily be
manipulated as a "parse tree" of the code, and that parse tree is
a very close representation of the source code (without a lot of
extraneous nodes and other cruft like you get from many other
parsers).

The poster I was responding to seemed to think I was talking
about just passing around and executing a bit of code.  Heck, you
can do that even in C on most Unix systems: write the string
containing the code to a file, run a C compiler on the file, link
the objct file to create a dynamically linked library, dlopen()
it, dlsym(), and call.


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"There are many causes worth dying for, but  !  bellman @ lysator.liu.se
 none worth killing for."         -- Gandhi  !  Make Love -- Nicht Wahr!



More information about the Python-list mailing list