Hacker News new | past | comments | ask | show | jobs | submit login
ClojureScript One (clojurescriptone.com)
214 points by fogus on Jan 11, 2012 | hide | past | favorite | 45 comments



ClojureScript is the only compile to JS language that I'm aware that lets you fully leverage the power of modifying JavaScript prototypes w/o fear of gross incompatibilities:

http://clojurescriptone.com/documentation.html#one.color

Note that they've extended (safely because of namespaces) browser natives including Element, Array, String, as well as the custom ClojureScript data types to respond to the color function.


Thanks for putting that together, especially the documentation! I think that I would save a lot of time, eventually, using a uniform Clojure development environment for server side and client side, but I am hesitant to spend the learning curve time right now. (Clojure, Noir, and Javascript are working out really well for me.)

Your good job on documentation will get me to spend the learning curve time sooner than later.

I also do work using GWT and SmartGWT and the uniform development environment (even if it is Java :-) really helps work flow.


Don't thank me, thank fogus & Clojure/core! :)


Actually you should thank Brenton Ashworth, Craig Andera, Jen Myers, and Kevin Altman. It is and looks as beautiful as it does because of them.


Thanks Michael and Clojure/core!

fixed. (please keep the original thanks though, for your other Clojure projects)


You guys are doing excellent work. I also find what you are doing with predicate dispatch very interesting. I think that class of methods are/will be really powerful - especially for big complicated programs. Have you been able to get it to work efficiently for most cases in clojurescript and in general?


We're not quite there yet with predicate dispatch. However if the pattern matching benchmarks are any indicator, it will be plenty efficient. Definitely excited about it, but it might be some time since it will require some well considered synergy between core.logic and core.match.


I assume this is just-launched, but being able to do examples online would be amazing. I believe ClojureScript does not include (eval) so you'd have to route to the server and back; perhaps this is feasible?


There is a clojure jail so yah it is feasible.


Looks great. What I would love to see is a ClojureScript tutorial that doesn't assume you already know Clojure.


ClojureScript is a subset of Clojure, so you do need to more or less know Clojure. The main benefit to ClojureScript is that you can use essentially the same language on the front- and back-ends.


Yes, but it doesn't really mention that in the documentation. It would be good to something along the lines of "You will need to know Clojure to use ClojureScript One, go here to learn it".

This looks excellent though - I'll give it a go once I think of a toy project to try it with.


It would be supercool to see something like this using websockets.


Here is a good example of ClojureScript <-> Clojure communication https://github.com/neotyk/ws-cljs It uses the Aleph Clojure library on the server side.


I have not jet seen a ClojureScript-to-Clojure websocket library thing. Would be cool to see.


How good is the interop with existing js libraries? Would i be able to use webgl or three.js?


The short answer is yes, ClojureScript has similar interop features for vanilla JS as Clojure for the JVM has for Java.

However, given that ClojureScript uses the Google Closure compiler to optimize production code, there are a few gotchas to be aware of. This article does a great job at explaining the details:

http://lukevanderhart.com/2011/09/30/using-javascript-and-cl...


Thank you very, very much for this.

Note: Installing failed for me until I replaced git:// with https:// in two places in script/deps. Then it worked.


Strange for me it was he other way around. I had to replace https:// with git:// , perhaps it depends on the git version? mine was probably pretty old.


Thanks for pointing that out. We've fixed it and pushed the new script.


View -> Source on this page. Just do it.


Yes, do it! The people downvoting you obviously didn't!


Or they did it but only on the first page. What you should look at is the source for the documentation page (http://clojurescriptone.com/documentation.html).


From a design perspective, that is one sweet looking site! Who created it? With what?


Okay, that was kind of a dumb question. I assume it's created using ClojureScript One. What I meant was how was the visual design created?


This podcast from Relevance - http://thinkrelevance.com/blog/2012/01/12/podcast-episode-00... talks about the development of ClojureScript One, and names a few people responsible for the visual design.

I believe Jen Myers (@antiheroine) is one of them.


How do I [intelligently] choose ClosureScript over say, Node.js?


You have to start by comparing apples to apples. ClojureScript is a programming language which compiles to JavaScript, Node.js is a runtime platform which executes JavaScript.

So in this case you can actually use both.


This is definitely a question worth asking. I think the audience ClojureScript is most appealing to is those who are already writing server-side stuff in Clojure and want to have a consistent front end or "old-school Lisp hackers" who are now writing web applications.

Personally, I'm attracted to Lisp/Clojure because of its AI history but haven't put the time in to build anything real with it yet. Are there people who have switched away from (Node || Python || Ruby) && JS who could discuss their experience?


I've done Ruby for years and I've written one large commercial project in clojure. Clojure was great, and I would love to use it more, but I haven't been able to convince people to use a lisp.

It's very strange actually, I tried really hard to do a small project in clojure at my current job and got resistance from everyone. These same people were happy to try coffee script, scala, golang, etc, etc. There seems to be a true bias against lisps.


Personally, all I can say is: Other people can choose to accept or reject parentheses. As people who know and understand the power and inherent elegance of the language we need to skip the step where we yearn for recognition and go straight to the "doing really fantastic stuff and making you jealous" portion of the narrative.

We dote too much on the history of Lisp w/r/t Clojure IMO. Clojure is not CL. Clojure is not Scheme. Clojure is not Haskell. Clojure is Clojure. It has its own state, identity, and time. Make great stuff with it and other people will follow. My feeling is that was need to quit waiting for approval and simply draw the line in the sand. I would be happy to forfeit future programming job opportunities if it meant committing to a language that solves the problems I care about. Will everyone do that? Unlikely. Will the people who know better than to settle for second best do it? I have a feeling the answer there is closer to yes.


The joke is, David Wheeler demonstrated years ago that you don't need most of the parens:

http://www.dwheeler.com/readable/sweet-expressions.html

It wouldn't be too hard to develop an indentation-based dialect of Clojure.


This is well known and has allready been done for clojure (cant remember where I saw it).

There are problems with this syntax when you combine it with macros. There is some work done to solve this but not much. For a (theoretical) lisp that works this way, see here: http://users.rcn.com/david-moon/PLOT/


Rich Hickey's "Simple Made Easy" talk from Strange Loop is filled with great ammo: http://www.infoq.com/presentations/Simple-Made-Easy

Personally, it gave me new vocabulary and conceptual tools for explaining why I like Clojure so much.


Oddly, the thing that triggers ire seems to be the presence of a left paren at the start of a line. (Many constructs in Clojure involve fewer parens than the same construct in Java, so the mere number of parens is therefore not a reason to avoid Clojure.)


People see parens and freak out. I once interviewed a guy who said his least favorite language was Lisp. I didn't know it was at the bottom of anybody's list!


That's really interesting to hear a real-world example. Can you say more about the reasons they gave you?


The contexts are all different. A VP told me that he had a bunch of mediocre programs and it would be hard from them to use it, and hard to hire new programmers. A friend of mine who tries new languages all the time simply doesn't like it cause it's a lisp. A Director at a different company didn't say clearly, but it seemed to boil down to it being a lisp. H was fine with us trying Scala or even golang, but no clojure.


Pros and cons. Switching away from a mainstream language is hard; you lose the community and all the work going to it. But you gain a lot of technical power, and possibly find a small community of really smart people.

Sometimes you can get the best of both worlds by doing something like ClojureScript, which is to compile to a mainstream language. That is compelling.

In the end, Lisp is really powerful, it's better than other languages, and it's worth learning. If you can deal with the lack of a huge community, you'll be fine. Clojure is gaining quite a large following, actually, so it's one of the best environments to learn Lisp.


I’m a Clojure user that switched from Python. We’re now using it at the startup I founded. So far it seems to have been a great decision.


You don't have to choose one or the other. You can target Node.js with ClojureScript.


But then you're missing one of the best features of developing with Node.js (one less context switch).


Which is a likewise reason for using Clojure in the client and server passing Clojure between the two.


What I meant to say is "based on ecosystem, performance, scalability and learning curve, is there a compelling argument that would convince me to change from my current language/framework/platform to this one?"


For the server side, Clojure, by most metrics, would beat node.js by virtue of running on the JVM and its stellar concurrency capabilities. This includes ecosystem, performance and scalability.

Using ClojureScript in the browser gives you a language to use that's consistent with what you're using on the server, and easy interop (you can just send data back and forth directly, without having to do any extra serialization). It's also (in my opinion) a much better language than JavaScript.

Learning curve is the one likely stickler - depends how inclined you are to learn a Lisp. Personally, I love it.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: