[ANN] ClojureScript

466 views
Skip to first unread message

Christopher Redinger

unread,
Jul 20, 2011, 8:40:32 PM7/20/11
to clo...@googlegroups.com
In case you missed the announcement streamed from this evening's NYC Clojure Group.


Clojure to JS compiler. Power of Clojure. Reach of JavaScript.

Please use this Clojure mailing list for ClojureScript discussion.

We plan to have a recording of tonight's talk posted soon.

Marko Kocić

unread,
Jul 21, 2011, 10:10:52 AM7/21/11
to clo...@googlegroups.com
Where is the bug tracker for ClojureScript?

For example I would like to report that windows scripts are missing.

Regards,
Marko

Stuart Halloway

unread,
Jul 21, 2011, 10:31:50 AM7/21/11
to clo...@googlegroups.com
Where is the bug tracker for ClojureScript?


Stu

Stuart Halloway
Clojure/core
http://clojure.com

Vincent

unread,
Jul 22, 2011, 6:05:29 AM7/22/11
to clo...@googlegroups.com
What is possible use of ClojureScript ?

Mark Rathwell

unread,
Jul 22, 2011, 7:51:44 AM7/22/11
to clo...@googlegroups.com

The main target use case seems to be browser based apps that would make heavy use of javascript, the kind of apps that would otherwise be built using with libraries/frameworks such as Google Closure Library, Dojo, SproutCore, Backbone w/ jQuery, etc.

Michael Fogus has also mentioned command line scripting as another possible use case, as node.js would not have the slow jvm startup times that make CLI work rough right now.



On Fri, Jul 22, 2011 at 6:05 AM, Vincent <vince...@gmail.com> wrote:
What is possible use of ClojureScript ?

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

faenvie

unread,
Jul 22, 2011, 9:07:36 AM7/22/11
to Clojure
in the first place i did not realize, how smart this move is,
but then ... clojure rocks ... javascript reaches ...

and as a sideeffect a first implementation of clojure-in-clojure
is rolled out into the wild even before clojure 1.3 is released.
in addition that works as a showcase for porting clojure to 'foreign'
host-systems.

IMO dependency on gclosure is a risk but pros oubalance cons
in this respect.

congrats

Vincent

unread,
Jul 22, 2011, 1:48:22 PM7/22/11
to clo...@googlegroups.com
that means , if i write a clojure program using javax.swing to build windows based appl. manipulating database at backend ( all written in clojure)
, this will be converted to javascript and we will be able to run as web appl....just as GWT.


Wilson MacGyver

unread,
Jul 22, 2011, 1:52:13 PM7/22/11
to clo...@googlegroups.com

No I don't think so. Clojurescript doesn't have java libs, so your swing calls will nit work

Mark Rathwell

unread,
Jul 22, 2011, 1:53:16 PM7/22/11
to clo...@googlegroups.com

No, you cannot use java libraries with ClojureScript, you would instead use the Google Closure Library or pure clojure.  Same as with the CLR version, you can only make use of .NET libs.


On Fri, Jul 22, 2011 at 1:48 PM, Vincent <vince...@gmail.com> wrote:
that means , if i write a clojure program using javax.swing to build windows based appl. manipulating database at backend ( all written in clojure)
, this will be converted to javascript and we will be able to run as web appl....just as GWT.

Sean Corfield

unread,
Jul 22, 2011, 7:51:01 PM7/22/11
to clo...@googlegroups.com

No, but I expect you could use ClojureScript on top of Node.js to
build end-to-end web applications using the various database modules
for Node.js (just like you'd use wrappers around Java libraries in
regular Clojure). It might be interesting to see some of the Clojure
libraries that wrap Java libraries get Node.js compatible variants...
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Arthur Edelstein

unread,
Jul 23, 2011, 1:22:24 AM7/23/11
to Clojure
Hi Christopher,

> We plan to have a recording of tonight's talk posted soon.

I'm looking forward to seeing it. Thanks! :)

Arthur

atucker

unread,
Jul 23, 2011, 12:46:27 PM7/23/11
to Clojure
Aughh! This is great (and a smart move). But I'd assumed CHouser's
original Clojurescript was dead, and spent the last two months
learning Javascript itself! Why so secretive?? A

Peter Taoussanis

unread,
Jul 24, 2011, 1:44:21 PM7/24/11
to Clojure
Just want to throw in on this real quick. I am -dumbfounded- by how
cool ClojureScript is.

It was about 2AM my time when I first heard the announcement and I
stayed up another 3 hours after that watching Rich's talk and playing
with the samples. As I see it right now, this is a Big Deal. For lots
of reasons. And I suspect it might take some time for the whole
concept and its wide ramifications to fully digest for everyone.

Like many (I'm guessing), my first question was: will it work with
jQuery? I'd never even heard of Google Closure. Suffice it to say it
didn't take much time looking into it to get me excited. And for it to
click just how smart this whole approach seems it might just be.


I am, literally, deploying this to my web app right now. I've got a
Compojure route setup for a the resulting output of memoized
ClojureScript compile call. I can work on the ClojureScript directly
from my project. When something changes, I re-evaluate the memoized fn
on my dev box (or on the production server through an SSH tunnel) and
boom: I have a fully-optimized script going out to users. Add in a
content-hash of the compiled script to automatically expire the old
resource, and I have a workflow that I couldn't imagine being much
better.

Client-side side stuff I've wanted to do with my app but couldn't even
begin to have the patience to implement- now suddenly seem trivial in
principle. Having access to the reader for transmitting native data
structures between the server and client... I don't even have the
words.


And this is just the stuff that touches me directly and that's
obvious. I can't wait to see what people are going to do with this in
time.


Thank you: awesome job, guys. And what an awesome surprise!

--
Peter

FL

unread,
Jul 25, 2011, 12:46:28 AM7/25/11
to Clojure


On Jul 24, 1:44 pm, Peter Taoussanis <ptaoussa...@gmail.com> wrote:
>
...
> I am, literally, deploying this to my web app right now. I've got a
> Compojure route setup for a the resulting output of memoized
> ClojureScript compile call. I can work on the ClojureScript directly
> from my project. When something changes, I re-evaluate the memoized fn
> on my dev box (or on the production server through an SSH tunnel) and
> boom: I have a fully-optimized script going out to users. Add in a
> content-hash of the compiled script to automatically expire the old
> resource, and I have a workflow that I couldn't imagine being much
> better.
...
> --Peter

Could you describe your setup in some more detail? (I'd like to use
clojure+clojurescript for a netCDF-compatible web mapping server.)

-F

Andreas Liljeqvist

unread,
Jul 25, 2011, 8:58:10 AM7/25/11
to clo...@googlegroups.com
There is some small mentions about mobile around Clojurescript.
What is the plan for Mobile integration?
Why wouldn't Clojure be a better fit on the androidplatform? (performance and build problems aside)

Sam Aaron

unread,
Jul 25, 2011, 10:01:26 AM7/25/11
to clo...@googlegroups.com
Hi Peter,

I would also love to know how you set this up in a little more detail. It really sounds like an excellent approach…

Sam

---
http://sam.aaron.name

Ghadi Shayban

unread,
Jul 25, 2011, 12:14:23 PM7/25/11
to Clojure
It will be a only a matter of time before people realize it doesn't
matter whether jQuery integrates or not. The examples/blog posts
coming out already are spectacular.

On Jul 24, 1:44 pm, Peter Taoussanis <ptaoussa...@gmail.com> wrote:

Hoornet

unread,
Jul 25, 2011, 2:22:03 PM7/25/11
to clo...@googlegroups.com
Anyone successfully stated this thing on windows yet?
I tried in no avail ...

Peter Taoussanis

unread,
Jul 26, 2011, 12:59:38 AM7/26/11
to Clojure
> I would also love to know how you set this up in a little more detail. It really sounds like an excellent approach…

Sure: it's not complicated! I'm writing this in a hurry though- so
hope it's still clear.

Basically I just define a memoized "dynamic scripts" function that
returns a map with a text/javascript Ring response, along with a hash
of that response.

So something like (def dynamic-scripts (memoize (function []
{:response foobar :hash (make-hash foobar)}))

Then I've got a Compojure route configured to serve requests like so:
(GET "/dynamic-stuff/:hash/scripts.js" {} (:response (dynamic-
scripts)))

This'll just send back the memoized script response anytime a request
is made for /dynamic-stuff/whatever/scripts.js

The /whatever/ is important since it let's me automatically include
the current hash in any script tags in the HTML with URI (str "/
dynamic-stuff/" (:hash (dynamic-scripts)) "/scripts.js").


Now all I need to do when I want to tweak the scripts is reevaluate
the namespace they're in and it'll re-hash, meaning that all future
requests for scripts.js go to the new resource - avoiding any possible
caching issues.


What I've described so far doesn't necessitate anything ClojureScript.
But with ClojureScript, the dynamic-scripts function can be easily
modified to produce it's response by compiling ClojureScript source.
This is awesome since it means I can keep everything in one
environment, and compilation happens automatically any time there is a
change to the underlying source. The scripts.js is always optimized,
always up-to-date, and always hashed to avoid caching problems.

When I want to test a change to the scripts, I just reevaluate the ns
then refresh my browser and the changes are live. If there's a major
compile-time bug in the scripts, it'll get caught before any changes
take affect.

BTW if the devs are listening, it'd be nice if cljsc/build could one
day also support input/output directly via strings :) That'd make all
this absolutely trivial(er).

--
Peter

Hubert Iwaniuk

unread,
Jul 26, 2011, 2:44:11 AM7/26/11
to clo...@googlegroups.com
Thanks Peter for sharing this.

Great workflow!

Cheers,
Hubert.

Reply all
Reply to author
Forward
0 new messages