Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Even when it comes to simple function redefinition, Python is __nowhere near__ the flexibility of Common Lisp and that's why things like pyrasite are gimmicks and seldom used in the wild.

The underlying reason is twofold:

+ Python lacks symbols

+ The Python module system is very simplistic

Symbols allow CL to abstract how variable/function access takes place [through the symbol]. Thus, when you change a function's code, everyone that was using the function (through its symbol) will transparently see the change.

In Python there are no symbols but references. When you change the code of the function, you have to manually update all references to point to the new code. If you also take into account the primitive module system that Python throws at you, it gets really messy really fast.

Function redefinition in Common Lisp is part of what makes CL great and the language development environments are geared around it. In sort, Common Lisp developers use it all the time, it's not a gimmick. I never build my full Python programs at the Python REPL, by keeping a single Python process live and iteratively changing its state. I experiment at the Python REPL, sure, but it's so crude and primitive (and the language of course fights you on this by not being geared around interactive development of this sort) that it's impossible to work in the fashion I just described.

When I build a program in Common Lisp, the Lisp process is always live, always running. I am always working inside it and it feels natural and easy.

And of course, this is just one small thing out of the entire 'interactivity' picture when it comes to CL.

The condition system, the object system, the reader, the compiler (available at runtime) and compiler macros ... there is absolutely nothing that comes close to what Common Lisp offers in terms of interactivity today (except maybe Smalltalk which has issues with performance, Forth and to a much more limited extent, Erlang).

I feel that people who point to Python/Ruby/Javascript REPLs or Java/.Net as realistic alternatives when it comes to interactive development and rapid prototyping, have either no experience with or absolutely no understanding of what Common Lisp offers.



Just so there's no misunderstanding: I've used CL and I know it's interactive features are better than python. I wasn't saying python is comparable here.

I just want to clarify that the method I mentioned doesn't require finding all references to the original function. It's mutating the function object, so all references will see the updated version.


> except maybe Smalltalk which has issues with performance, Forth and to a much more limited extent, Erlang

Just to add to the "performance" aspect, Lisp, with modern compiler like SBCL, is generally close or at the same speed as Java (under Oracle's JVM). Which is pretty good.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: