9 ms·
ClojureScript
- jgrant27 15y agoNow we have a "solid" Lispy alternative to imperative languages that compile to JS. Nice surprise Rich !
- grayrest 15y agoThere are a LOT of in-browser scheme-like variants.
- DanielRibeiro 15y agoA few are listed here: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS https://github.com/jashkenas/coffee-script/wiki/List-of-lang... (which also includes Clojurescript)
- zaph0d 15y agoThat ClojureScript is the (mostly experimental & now obsolete) work done by Chris Houser quite some time back. These two are not the same thing.
- DanielRibeiro 15y agoThank both you and lukev for pointing it out. Edit: Now they are both on the list. Gotta love Github's wiki.
- lukev 15y agoThat ClojureScript is actually a different project, and is a much less complete implementation. IIRC, it's not a true compiler like the new ClojureScript, but just uses macros to transform forms to Javascript. This announcement probably makes that one obsolete.
- drcode 15y agoYes, but the folks that created this one have a high reputation, and this version goes to a far extent to maintain strong performance.
- jgrant27 15y agoClojureScript seeks to address the weak link in the client/embedded application development story by replacing JavaScript with Clojure, a robust, concise and powerful programming language. In its implementation, ClojureScript adopts the strategy of the Google Closure library and compiler, and is able to effectively leverage both tools, gaining a large, production-quality library and whole-program optimization. ClojureScript brings the rich data structure set, functional programming, macros, reader, destructuring, polymorphism constructs, state discipline and many other features of Clojure to every place JavaScript reaches.
- felideon 15y agoYou mean other than Parenscript[1], which seems to have been written about 4 years ago? Edit: Parenscript was just the first to come to mind, but check out http://www.cliki.net/JavaScript http://www.cliki.net/JavaScript [1] http://common-lisp.net/project/parenscript/ http://common-lisp.net/project/parenscript/
- angus77 15y agoVersion 0.1.0 came out in early 2005, so it's been around more than six years.
- SergeyHack 15y agoSee this comment - http://news.ycombinator.com/item?id=2788849 http://news.ycombinator.com/item?id=2788849
- deleted 15y ago[deleted]
- runevault 15y agoNode.js + clojurescript just came up in the Demo. Part of me says awesome, another part says "How many hipster programmer brains blew up" <_<. Overall I'm excited about this and anxious to see how far it can be taken, because if you can write an ENTIRE webapp in clojure is thought provoking.
- fogus 15y agoNode.js is the pragmatic choice for ClojureScript command line apps. One of Clojure's weaknesses was that the JVM was not a great choice for these types of scripts. ClojureScript + Node.js effectively solves this problem.
- runevault 15y agoOh I fully agree with that, and even if we got NOTHING else from this that would be cool. I just can't help from finding some humor in the idea as well.
- technomancy 15y agoI don't understand; why bring a web framework into it for command-line work? Is it just that straight-up V8 has a crappy CLI experience?
- fogus 15y agoWeb framework? Do you mean Google Closure? If so, bear in mind that the compilation phase will remove unused code, so you're not forced to carry any of it with you if you never use it in your code. As for Node, you do not need it I suppose, but I do not have experience using straight-up V8.
- technomancy 15y agoRight, I was talking about node. It sounds like perhaps node has had more people polishing the command-line tools? Stuff that probably belongs in V8, but goes in node because it's a more openly-developed project? The mention of node just seemed a little out of place at first glance.
- vdm 15y agohttps://github.com/clojure/clojurescript/wiki/Rationale https://github.com/clojure/clojurescript/wiki/Rationale > ClojureScript seeks to address the weak link in the client/embedded application development story by replacing JavaScript with Clojure, a robust, concise and powerful programming language. In its implementation, ClojureScript adopts the strategy of the Google Closure library and compiler, and is able to effectively leverage both tools, gaining a large, production-quality library and whole-program optimization. ClojureScript brings the rich data structure set, functional programming, macros, reader, destructuring, polymorphism constructs, state discipline and many other features of Clojure to every place JavaScript reaches.
- kennystone 15y agoIt's interesting how closely tied to Google Closure this is. I wonder if that will present issues in the future. Regardless, ClojureScript has definitely made really smart use of it.
- ThisIBereave 15y agoI presume Closure is only being used as a post-processing step to optimize the javascript that's produced.
- devin 15y agoFalse. We're not just talking about Closure. We're talking about Google Closure. They support millions of users with their apps and maintain cross-browser compatibility. Google is doing that huge block of work for ClojureScript in addition to whole-program optimization.
- ThisIBereave 15y agoGoogle Closure is what I'm talking about too. However, it's important to know _which_ Google Closure, as there are a number of components. It seems that the component most used in ClojureScript is the JavaScript optimizer, which is most likely just run as a post-processing step. Of course, ClojureScript could also be using the Closure Library within the code, which would integrate Closure deeper into the system.
- thorstadt 15y agoYou can use other javascript libraries in addition to Closure (i.e. jquery). https://gist.github.com/1096382 https://gist.github.com/1096382
- jimbokun 15y ago"It's interesting how closely tied to Google Closure this is. I wonder if that will present issues in the future." It will definitely present issues to verbal communication. "Yes, you see, Clojure uses Closure as part of it's implementation blah blah..." "Wait, Clojure uses Clojure?" "No, with-a-J-Clojure uses with-an-S-Closure..."
- ivanzhao 15y agoGiven a radical departure from the JavaScript core (comparing to Coffeescript), I wonder how easy the debugging would be.
- drcode 15y agoI suspect you'll get good line number info but you'll have to deal with limitations in terms of real-time debugging (beyond having access a repl)
- devin 15y agoThis is an itch that will be scratched. Today's announcement was for an alpha release, not a polished, production-ready one.
- abi 15y agoPresumably, you wouldn't have to look at the Javascript source because the Clojurescript should directly tell what's wrong when it's compiling to Javascript. This is different from Coffee because Coffee is only a compiler front-end (a lexer/parser) and thus, doesn't really provide any execution semantics.
- jdkoeck 15y agoNo. The clojure compiler only complains about compilation errors, which doesn't help at all when you're debugging runtime errors. For clojure to be usable for serious client side development, you would definitely need a browser extension that relates the location of runtime errors in the compiled JavaScript back to the clojure source code. Which is precisely what something like GWT gives you (and more).
- andrewvc 15y agoI'm wondering if this has the refs, agents, and atoms that make concurrent clojure so awesome. If not, it would feel.... strange.
- runevault 15y agoThe impression I got is the core syntax is all there, you just don't get access to the jvm libraries anymore.
- fogus 15y agoAll of the core syntax is not currently there, but you're right that ClojureScript only interops with js and not Java. For a more detailed differences list see https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure https://github.com/clojure/clojurescript/wiki/Differences-fr...
- runevault 15y agoNo STM, that'll be interesting. Ack no transients either! I know it's early but not gonna lie that one makes me sad. I love being able to write stupid fast list/map builder functions that bash inline but then return something nice and immutable.
- fogus 15y agoBear in mind that the wording is very careful. We took great pains to say things like "not currently implemented." ;-)
- SomeIdiot 15y ago"ClojureScript does not currently support regular expression literals using #"" " This one seems like a big deal, given how often I find myself using regexes in clojure. Is it on its way and is there a workaround currently?
- 15y ago
- robobenjie 15y agoI am a clojure intermediate-beginner who would like to use it to learn about web technologies, which I know almost nothing about. Would people recommend this as an entry point? If not what would you recommend instead?
- frou_dh 15y agoI think it would be a bit too meta (and work in progress) to start with. Check out this article for standard Clojure (A Brief Overview of the Clojure Web Stack): http://brehaut.net/blog/2011/ring_introduction http://brehaut.net/blog/2011/ring_introduction
- deleted 15y ago[deleted]
- jamiltron 15y agoI have been tinkering with Clojure off and on for the past year, and I only recently have started with Clojure's web technologies. Currently the documentation is a mess. I've slowely been learning by looking at very basic examples, and then needing to read source code to fill in the details for the stuff I wanted to do. While there's a great deal of excitment for ClojureScript, I feel that it as an entry point (at least for me) wouldn't have enough docs for me to learn quick enough so I wouldn't become frustrated. YMMV, of course, but I think you'd be better off looking at Compojure or Moustache, Enlive or Hiccup, and Ring , or even Noir: www.webnoir.com
- schiptsov 15y agoYes, pile it up! Now we all need Coffeescript for Clojurescript. ^_^
- aidenn0 15y ago"Numbers: Currently ClojureScript numbers are just JavaScript numbers" Boo. I'm sure this is for performance reasons, but JS numbers really need an overhaul.
- mo1stt 15y ago> ClojureScript seeks to address the weak link in the client/embedded application development story by replacing JavaScript with Clojure, a robust, concise and powerful programming language. In its implementation, ClojureScript adopts the strategy of the Google Closure library and compiler, and is able to effectively leverage both tools, gaining a large, production-quality library and whole-program optimization. ClojureScript brings the rich data structure set, functional programming, macros, reader, destructuring, polymorphism constructs, state discipline and many other features of Clojure to every place JavaScript reaches.
- mo1stt 15y agohttp:www.nurhadi.info
- sleight42 15y agoI'm both curious and surprised by the lack of comments/questions about the quality of the generated JS. Can anyone who has played with it speak to the quality? How does the generated code stack up against say Coffeescript's?
- semperos 15y agoTo better understand how different ClojureScript is from CoffeeScript, read the last paragraph on the ClojureScript wiki's Rationale page: https://github.com/clojure/clojurescript/wiki/Rationale https://github.com/clojure/clojurescript/wiki/Rationale It's purpose is not to compile down to vanilla, readable JavaScript, but rather to make it easy to write production-ready JavaScript applications that can easily leverage the "advanced mode" of the Google Closure compiler.
- swannodette 15y agoI'd say it's pretty good, http://blog.fogus.me/2011/07/21/compiling-clojure-to-javascript-pt1/ http://blog.fogus.me/2011/07/21/compiling-clojure-to-javascr...
- markokocic 15y agoI havent look at the implementation yet, but the question that comes to mind is is this one step closer to "Clojure in Clojure"?
- SergeyHack 15y agoYes, it's a big step in that direction. Rich said it should be easy to change JS target for another.
- redline6561 15y agoI would assume however that threading concerns have not been taken into account for the "Clojure-in-Clojure" on display in ClojureScript however, based on https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure https://github.com/clojure/clojurescript/wiki/Differences-fr... That suggests to me that concerns over thread safety that are taken into account in the Java implementation, say of the core data structures, STM, etc, are not taken into account in the std. lib. of ClojureScript. That would make it unlikely for this code to be a useful origin or starting point for, say, an LLVM backend. Rich is a very clever fellow and makes fascinating trade offs between pragmatism and idealism in his language design. He continues to build languages quite tied to some existing runtimes which embrace their advantages and drawbacks. Consequentially, it will be very important to keep the rationale in mind while evaluating the real impact of ClojureScript. https://github.com/clojure/clojurescript/wiki/Rationale https://github.com/clojure/clojurescript/wiki/Rationale As neat as it would be to see, it will be a long time before an x86 or ARM backend emerges. As far as I know, the G1 Garbage Collector in the JVM is still the top of the crop of production GCs and even Haskell with GHC7 is still working towards something of similar potency. See http://hackage.haskell.org/trac/ghc/blog/new-gc-preview http://hackage.haskell.org/trac/ghc/blog/new-gc-preview Concurrent GCs and other aspects of runtimes geared towards heavy concurrency are insanely hard. Just something to keep in mind.
- funcall 15y agoClojureScript is a fantastic piece of engineering. I'm the author of ClojureJS, one of the few Clojure libraries that implemented Clojure to JavaScript translation (with predictable scoping semantics). After having looked over the ClojureScript sources, I'm convinced this is a far more sophisticated compiler with a sound namespace strategy. The namespace and compile time checks alone are worth the price of admission. Plus macros, which was the biggest motivator for building ClojureJS. Suffice to say, if ClojureScript (in its current form) had existed 7 months ago, I'd never have considered building anything on my own. That's not to say I'm not proud of ClojureJS. It was born out of a real need that I had, and has been enhanced by some very valuable contributions by people who also shared my excitement for writing browser clients in Clojure. I still need to understand the Google Closure integration impact, but from what Rich said at the ClojureNYC talk, it sounds worthy of study and adoption. Kudos to Rich, and the Clojure.Core team.
- deleted 15y ago[deleted]
- JoelMcCracken 15y agoThe biggest reason I've avoided Clojure in the past was because of the JVM. I know the interop is useful, but I really do not like Java, and the whole thing just stinks. This, on the other hand, I can get behind.