Why don't people like lisp?

Andrew Dalke adalke at mindspring.com
Wed Oct 22 04:53:45 EDT 2003


Peter Seibel:
> Right. Well that's one disadvantage, such as it is, of having the
> compiler built in--I'm at the mercy of its error reporting and Lisp
> isn't big on line-numbers, perhaps because many definitions don't come
> from a file.

True enough, but I sketched out a few ways that could work in
Python and they would work equally well in Lisp.

> What I didn't show in the output was that I was actually
> dropped into the debugger at that point so had all the capabilities
> that it provided to figure out what was going wrong. Anyway, that's
> the price I pay for getting machine code I guess.

I haven't used the Python debuggers (I'm still stuck in the
archaic era of print statements ;) so I can't compare.  In any
case, the error reporting is going to be at the level of the
translated code, which may or may not be helpful.

There is a compiler for Python code called Psyco, but it only
works for Intel hardware and my primary platform is a Mac.
I have an old copy on my Intel box, but it needs a recompile
to support dumping the assembly code, and that's too much
effort for this task.

> I could, if it was
> really important wrap all the function calls in condition handling
> code that reported the line number but it didn't seem worth it.

Yup, it ain't.

> replacing a call to the built-in READ-FROM-STRING with my own
> next-token function. The rest of the patch is my own simple tokenizer.

Interesting.  The code reminds me of working with strings
in Pascal, because it tracks the string and the offset.  Equivalent
C code would use the pointers directly.  But Python code
works as a larger chunk level, with split() and regexps, in
part because working at the lowest level requires a lot of
fiddling around with things that are slow in native Python. (Eg,
I would do i=s.find("a") instead of
for i in range(len(s)):  if s[i] == 'a': break )

Well, *I* thought it was interesting.

> (And I had to redefine variablep to allow weird variable names.) The
> tokenizer could probably be written better but it's late here and I
> should be in bed.

Understood.  Also, my schedule is so backwards now that I'm
going to bed when the sun rises.  :(

> Actually the key line is the one I patched above. This is just
> generating the form which Lisp knows how to compile. But since Lisp
> symbols can actually contain any character, as long as they're
> properly escaped I have no real problems.

Got it.  I was thinking {} is equivalent to a paste when it's
more like an insert.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list