6 ms·
LispyScript
- evmar 11y agoCoincidentally, I've been fiddling with a rather similar project, just as a hobbyist thing. It looks like this one is much farther along, kudos! Unfortunately from the contributions graph perhaps interest in it is dying off -- the last 10% (aka the last 90%) is always the hardest part to slog through... 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 https://github.com/martine/pjs/blob/master/lib/macro.pjs
- 1971genocide 11y agoAlso check out LiveScript. http://livescript.net/ http://livescript.net/ and its awesome FP library inspired by haskell's prelude.hs http://www.preludels.com/ http://www.preludels.com/ 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.
- amyjess 11y agoWhy did they name it that? LiveScript was Netscape's original name for JavaScript, before Sun asked them to throw in some Java branding.
- rane 11y ago> 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.
- lighthawk 11y agoNeat! Now look at: https://github.com/clojure/clojurescript https://github.com/clojure/clojurescript And try it: http://himera.herokuapp.com/index.html http://himera.herokuapp.com/index.html
- zupatol 11y agoClojurescript has to be compiled by the google closure compiler on the server side. The closure compiler doesn't work out of the box with other libraries, you need some kind of bridge. 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.
- swannodette 11y agoSome inaccuracies here. ClojureScript does not have to be compiled by Google Closure. That pass is an optional one for production builds. There is no "bridging" when using the Closure Compiler with non-Closure compatible code. The issue is that in production mode the Closure Compiler will make aggressive assumptions about what it can rename. So it's not about bridging it's about preventing renaming - again this is only relevant for advanced production builds. 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.
- didyoucheckthe 11y ago> "again this is only relevant for advanced production builds" So, all real-life builds that anyone would care about.
- moron4hire 11y agoThis needs to be stressed. Performance in mobile web is already bad enough. If a tool has an optional, manual "improve performance" step, that is bad, it needs to be the default case and it needs to be a good citizen within the environment.
- aidenn0 11y agoSee also: https://github.com/vsedach/Parenscript https://github.com/vsedach/Parenscript TLDR: s-expression syntax for javascript, macros are written in common lisp.
- grayrest 11y ago> An inherent problem with Javascript is that it has no macro support, unlike other Lisp like languages. http://sweetjs.org/ http://sweetjs.org/ There are macro systems for Javascript, just not native ones.
- JoelMcCracken 11y agoNot that you're wrong -- you're correct -- but I want to bring up that this was likely true at the time this was written. LispyScript has been around for a while.
- drunkcatsdgaf 11y agoFirst commit for lispy - march 5, 2012 First commit for sweet.js - August 1, 2012 im actually pretty shocked they are that close together.
- JoelMcCracken 11y agoI bet they both started around the time CoffeeScript started to get big -- it showed there was a market for compile-to-js-but-almost-js langs.
- amirouche 11y agoThe website is down right now. https://github.com/mozilla/sweet.js https://github.com/mozilla/sweet.js
- Touche 11y agoalso http://sibilantjs.info/ http://sibilantjs.info/
- frakturfreund 11y agoAlso Spock (Chicken Scheme wiki): http://wiki.call-cc.org/eggref/4/spock http://wiki.call-cc.org/eggref/4/spock
- Turing_Machine 11y agoBiwaScheme is also pretty decent. http://www.biwascheme.org/ http://www.biwascheme.org/
- lispm 11y agoDoesn't look like Lisp, more like Clojure. Basically none of the functions, macros or syntax is from Lisp. The documentation says: http://lispyscript.com/docs/ http://lispyscript.com/docs/ > 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.
- moron4hire 11y agoThis is why I called my version of this "Loosp", because it required a very loose (so probably incorrect) definition of Lisp to call it a Lisp: https://github.com/capnmidnight/betty-boop/blob/master/pong.html https://github.com/capnmidnight/betty-boop/blob/master/pong....
- gjm11 11y ago> Basically none of the functions, macros or syntax is from Lisp. 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.
- lispm 11y agoWell said! ;-)
- jestar_jokin 11y agoDoesn't it say something about JavaScript, dissatisfaction with it, and the overwhelmingly splintered ecosystem, when every comment is suggesting alternatives to the solution in the article? 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."
- elwell 11y agoWisp should also be added to this list: https://github.com/Gozala/wisp https://github.com/Gozala/wisp
- sebastianconcpt 11y agoNice! reminded me of http://ympbyc.github.io/LittleSmallscript/ http://ympbyc.github.io/LittleSmallscript/
- rndn 11y agoThere is no shortage of JavaScript-Lisps, that’s for sure!
- breuleux 11y agoI wouldn't say Lisp-like syntax is necessary for a macro system. It helps a bit... but all things considered, I believe pattern matching is a bigger boon to macro writing than syntax per se. For those it may interest, I have made a language with mostly conventional syntax which supports macros: http://breuleux.github.io/earl-grey/ 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.
- ktg 11y agoLispScript | https://bitbucket.org/ktg/lispscript https://bitbucket.org/ktg/lispscript Try LispScript | http://ktg.bitbucket.org/lispscript/lispscript.html http://ktg.bitbucket.org/lispscript/lispscript.html
- woadwarrior01 11y agoNice. This is reminiscent of HyLang[1], which is like this for Python. [1]: http://hylang.org/ http://hylang.org/