a life of coding

Friday, January 04, 2008

FYI: JavaScript is Lisp

Just a heads up in case anyone hasn't figured this out yet.


  • It's Lisp... with all sorts of extra implicit type conversions?

    (the eval, though -- eval is pretty lispy :) )

    By Blogger Alex R., At 1/8/08 10:08 PM  

  • Yeah, the types of things can be interesting. The most common case is getting unintended string results, but variables of the "undefined" type are surprising for a while.

    Functions can also be called with any number of arguments: additional declared arguments are "undefined", runover passed arguments can be retrieved inside the function call via "arguments" variable. This can be quite useful - imagine all python function signatures ending in *args, **kwargs.

    Unfortunately, no macros. But, certainly the largest install base and best cross platform GUI support thats ever been associated with a lisp. If you're using Mozilla, you even have a great debugger (Venkman) and a standalone cross platform application framework (Xulrunner).

    Ultimately, eval isn't where I see lisp in JS. Its full featured anonymous lambdas and closures, a simple object system, minimal syntax, and the community. The guys working on javascript frameworks seem to have a functional approach and don't mind mixing data and code. Often times a reasonable solution to transporting objects and code is to stringify them to json and eval on the receiving end. I get a distinctly more lisp feel from JS than I do from python.

    A lot of people are turned off of lisp because of its lack of syntax... maybe JS is an acceptable syntax, and someday we'll have JS implemented as reader macros. ;-)

    By Blogger ynniv, At 1/8/08 11:11 PM  

Post a Comment


Create a Link

<< Home