AnNN: ClojureScript 0.0-2120

1,048 views
Skip to first unread message

David Nolen

unread,
Dec 13, 2013, 10:15:40 AM12/13/13
to clojur...@googlegroups.com, clojure
ClojureScript, the Clojure compiler that emits JavaScript source code.


New release version: 0.0-2120

Leiningen dependency information:

    [org.clojure/clojurescript "0.0-2120"]

Enhancements:
* inline source map information available to REPLs, enabled in browser REPL
* #js data literal support added
* :include-macros true and :refer-macros [syms ...] allowed in :require
* make-array now inlined into dense array, much faster PHM perf
* CLJS-673: support *print-level*
* expose Google Closure Compiler defines under :closure-defines
* expose Google Closure Compiler warnings configuration under :closure-warnings

Changes:
* latest Closure Compiler dependency
* CLJS-690: add sequence & sorted
* CLJS-709: optimize cljs->js for sequential collection to array
* CLJS-699: letfn fns not optimized

Bug fixes:
* CLJS-724: Range -first bug
* CLJS-725: fix broken optimizations around IndexedSeq
* fix broken behavior of #uuid and #inst data literals
* CLJS-697: top-level symbol reference doesn't get an automatically inserted ns-name
* CLJS-692: cannot access properties on imported GClosure constructors
* CLJS-480: reader/*data-readers* bound inconsistently

Tim Visher

unread,
Dec 13, 2013, 10:30:40 AM12/13/13
to clojur...@googlegroups.com, clojure
On Fri, Dec 13, 2013 at 10:15 AM, David Nolen <dnolen...@gmail.com> wrote:
> ClojureScript, the Clojure compiler that emits JavaScript source code.
>
> README and source code: https://github.com/clojure/clojurescript
>
> New release version: 0.0-2120
>
> Leiningen dependency information:
>
> [org.clojure/clojurescript "0.0-2120"]

Great to see another release!

I get bitten by this every time, so I don't know if it's worth
mentioning even though I should know better, but is it possible to
either resist announcing these until they're available from Maven
Central _or_ to mention each time that if you want it now, you should
add `:repositories {"sonatype-staging"
"https://oss.sonatype.org/content/groups/staging/"}` to your
project.clj? It's just a minor annoyance but, like I said, I'm bitten
by it every time.

Thanks in advance!

--

In Christ,

Timmy V.

http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail

Nelson Morris

unread,
Dec 13, 2013, 10:46:28 AM12/13/13
to clojur...@googlegroups.com, clojure
Enhancements:
* inline source map information available to REPLs, enabled in browser REPL

I have PRs into piggieback and austin to enable this in the future.  In the meantime, if you want to try it out you can clone https://github.com/xeqi/austin and https://github.com/xeqi/piggieback, and use lein's checkout dependencies.

-
Nelson Morris

David Nolen

unread,
Dec 13, 2013, 11:14:40 AM12/13/13
to clojure, clojur...@googlegroups.com
A big round of applause to Nelson Morris, Nicola Mometto, and Alex Redington - the REPL inline source maps would not have been possible without their work! And all the other contributors who submitted patches and bug fixes to this release too! :)

David


--
--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

da...@dsargeant.com

unread,
Dec 14, 2013, 8:53:09 AM12/14/13
to clojur...@googlegroups.com
Could you provide examples of the second and third enhancements?

Brandon Bloom

unread,
Dec 14, 2013, 11:07:35 AM12/14/13
to clojur...@googlegroups.com
> Could you provide examples of the second and third enhancements?

I'll let somebody else address the ns/macros stuff, but I can explain the #js data literal.

The idea is simple: JavaScript libraries make heavy use of JSON data, just like Clojure programs make heavy use of EDN data. Despite some similarity, ClojureScript does not make it easy to create JSON data. Calling JavaScript libraries from ClojureScript isn't quite as seamless as calling Java libraries from Clojure, since there is no shared interface for maps or sequences.

The #js data literals aim to make JSON *feel* more accessible from ClojureScript as the syntax level. This is accomplished by changing this:

(js-obj "arr" (array 5 10 15))

In to this:

#js {:arr #js [5 10 15]}

Notice: Only maps & vectors are supported. Map keys must be strings or keywords. The transformation is shallow, so you need the nested #js for the vector.

David Sargeant

unread,
Dec 14, 2013, 11:23:41 AM12/14/13
to clojur...@googlegroups.com
That looks great. Thanks for the example.

I'm assuming these are expanded at compile time, versus run time. Is that correct?

Brandon Bloom

unread,
Dec 14, 2013, 11:58:51 AM12/14/13
to clojur...@googlegroups.com
> I'm assuming these are expanded at compile time, versus run time. Is that correct?

Yes.

More specifically, the reader produces instances of a JSValue type which wraps a vector or map, then the compiler treats them as a new kind of composite by evaluating the contained elements or values.

David Nolen

unread,
Dec 14, 2013, 12:22:59 PM12/14/13
to clojur...@googlegroups.com
If you have a macro file with the same name as your ClojureScript file you can do the following:

(ns foo.bar
   (:require [foo.baz :include-macros true]))

Which is equivalent to

(ns foo.bar
   (:require-macros [foo.baz])
   (:require [foo.baz]))

Or

(ns foo.bar
  (:require [foo.baz :as baz :refer-macros [woz]))

Which is equivalent to

(ns foo.bar
   (:require-macros [foo.baz :as baz :refer [woz]])
   (:require [foo.baz :as baz]))


On Sat, Dec 14, 2013 at 8:53 AM, <da...@dsargeant.com> wrote:
Could you provide examples of the second and third enhancements?

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

David Sargeant

unread,
Dec 14, 2013, 12:56:10 PM12/14/13
to clojur...@googlegroups.com
Very cool.

So, just to confirm, you would need the following files in your example: foo/baz.cljs and foo/baz.clj.

David Nolen

unread,
Dec 14, 2013, 12:58:07 PM12/14/13
to clojur...@googlegroups.com
Exactly.


On Sat, Dec 14, 2013 at 12:56 PM, David Sargeant <da...@dsargeant.com> wrote:
Very cool.

So, just to confirm, you would need the following files in your example: foo/baz.cljs and foo/baz.clj.

Gary Johnson

unread,
Dec 16, 2013, 12:33:50 PM12/16/13
to clo...@googlegroups.com, clojur...@googlegroups.com
Wait a minute...


  #js data literal support added

Holy $#%^!!! Where is this documented?! MUST...USE...NOW!

Tim Visher

unread,
Dec 16, 2013, 12:36:09 PM12/16/13
to clojur...@googlegroups.com, Clojure

Gary Johnson

unread,
Dec 20, 2013, 2:42:19 PM12/20/13
to clojur...@googlegroups.com, Clojure
Thanks, Tim. I somehow missed Brandon's exposition earlier in the thread. These features look great. Fantastic job, ClojureScript devs!

Tom White

unread,
Feb 3, 2014, 4:29:19 AM2/3/14
to clojur...@googlegroups.com
On Saturday, December 14, 2013 8:07:35 AM UTC-8, Brandon Bloom wrote:
> The transformation is shallow, so you need the nested #js for the vector.

Was there a rationale for leaving this transformation shallow?

-Tom

Brandon Bloom

unread,
Feb 3, 2014, 9:25:34 AM2/3/14
to clojur...@googlegroups.com
It's a compiler transform that operates on literals before evaluation. What would it even mean for it to be deep?


--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/mUVbtdnAvHA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages