145 points · by amelius · 11y ago · 42 comments
Now look at: https://github.com/clojure/clojurescript
And try it: http://himera.herokuapp.com/index.html
Lispyscript has the very nice advantage of being able to run directly in the browser. Since it's translated directly to javascript, I expect it won't have problems using other javascript libraries.
That said for non-Web applications or applications where advanced compilation isn't that useful providing a bootstrapped ClojureScript is desirable. We've been working on that slowly for a long time now. In the coming months you'll see changes such that the ClojureScript compiler can itself be compiled into JavaScript.
So, all real-life builds that anyone would care about.
Once you have the JavaScript version of the ClojureScript compiler, will it be reasonable to use it for compiling in the browser? That would be great.
This turns out to be invaluable in production because most projects only realistically use a handful of functions from utility libraries that tend to be 10s of KBs in size.
I've been meaning to write up the various approaches to sexpressions+macros in JS. Mine differs from the others (and perhaps is closer to LispyScript) mostly in that it's close to JS in its names and semantics (e.g. "function" defines a function and you're still required to use a "return" statement), but then it lets you write macros to e.g. define "fn" where the return is implicit.
Anyway, here's some sample code from mine (which is itself defining macros used elsewhere in the compiler): https://github.com/martine/pjs/blob/master/lib/macro.pjs
The documentation says:
> LispyScript is not a dialect of Lisp. There is no list processing in LispyScript . LispyScript is Javascript using a Lispy syntax (a tree syntax).
That's about right. It actually uses some kind of s-expressions, but not Lisp syntax.
Sounds like it's extremely well named, then. LispyScript is to Lisp as Javascript is to Java: an entirely different language with different syntax, semantics, standard library and performance characteristics, but with just enough superficial similarity to provide plausible deniability for the name.
TLDR: s-expression syntax for javascript, macros are written in common lisp.
and its awesome FP library inspired by haskell's prelude.hs
I have done all forms of projects using LiveScript - robotics, simple websites, blog, cryptography, computer vision.
Its actually becoming silently fairly mature.
It helps when it doesn't generate any hype like most languages.
The community around is also very helpful !
And LiveScript is awesome with React.js or any other virtual DOM based MVC framework.
LiveScript was Netscape's original name for JavaScript, before Sun asked them to throw in some Java branding.
> Name
>
> LiveScript was one of the original names for JavaScript, so
> it seemed fitting. It's an inside joke for those who know
> JavaScript well.I guess we chalk this one up to "neat if you're a hobbyist or solo dev with no maintenance handover, but generally commercially unviable."
There are macro systems for Javascript, just not native ones.
im actually pretty shocked they are that close together.
For those it may interest, I have made a language with mostly conventional syntax which supports macros: http://breuleux.github.io/earl-grey/
The macro system is modular, so you can easily write and publish macro libraries. I have written some for testing, gulp, and react. It's not super mature but it's getting there.
[1]: http://hylang.org/
Try LispScript | http://ktg.bitbucket.org/lispscript/lispscript.html