How can I get core.async to work in Cljs in Cljs

569 views
Skip to first unread message

Zubair Quraishi

unread,
Dec 15, 2015, 4:34:51 AM12/15/15
to ClojureScript
I am trying to get core.async (go macros to work in cljs in cljs but they seem to do nothing. I try fully qualifying them as well with (cljs.core.async.macros/go but it makes no difference. Anyone else have core.async working with cljs in cljs?

Zubair Quraishi

unread,
Dec 15, 2015, 5:21:54 AM12/15/15
to ClojureScript
I also tried to do:

(:require-macros
[cljs.core.async.macros :refer [go]]
))

:but when I compile I get:

{:error #error {:message "Could not eval cljs.core.async.macros", :data {:tag :cljs/analysis-error}, :cause #error {:message "Invalid token: //", :data {:type :reader-exception, :line 11, :column 27, :file cljs.core.async.macros}}}}

mikef...@gmail.com

unread,
Dec 15, 2015, 7:05:07 AM12/15/15
to clojur...@googlegroups.com
Hi Zubair,

It definitely doesn't work as-is. I've been working through revisions to see if I can get it to load into Planck (and Elbow, a Replumb-based REPL for node). It's not complete, but my changes are in the self-host branch here if you are curious: 


- Mike

On Dec 15, 2015, at 4:34 AM, Zubair Quraishi <zub...@gmail.com> wrote:

I am trying to get core.async (go macros to work in cljs in cljs but they seem to do nothing. I try fully qualifying them as well with (cljs.core.async.macros/go but it makes no difference. Anyone else have core.async working with cljs in cljs?

--
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 https://groups.google.com/group/clojurescript.

Zubair Quraishi

unread,
Dec 15, 2015, 8:54:21 AM12/15/15
to ClojureScript
Hi Mike,
I took a quick look. Really happy that you are actively working on this too. When do you think a stable will be released? Just a ballpark figure I mean, so that I can plan around it?
thanks
Zubair

mikef...@gmail.com

unread,
Dec 15, 2015, 9:07:59 AM12/15/15
to clojur...@googlegroups.com
Hi Zubair,

I don't have specific plans to release a stable version. If things lead to that, I may consider it though. I can't speak to timelines either unfortunately.

- Mike

Zubair Quraishi

unread,
Dec 15, 2015, 10:08:03 AM12/15/15
to ClojureScript
Ok, but how does it work right now. Are you the main contributor for core.async for ClojureScript, or is someone at Cognitect working on it as well?

David Nolen

unread,
Dec 15, 2015, 11:02:31 AM12/15/15
to clojur...@googlegroups.com
Nobody at Cognitect is working on this. It's unlikely to be very high priority either as the payoff for most users is non-existent.

David

On Tue, Dec 15, 2015 at 10:08 AM, Zubair Quraishi <zub...@gmail.com> wrote:
Ok, but how does it work right now. Are you the main contributor for core.async for ClojureScript, or is someone at Cognitect working on it as well?

Zubair Quraishi

unread,
Dec 15, 2015, 1:39:41 PM12/15/15
to ClojureScript
Ok, makes sense. Is there a roadmap or something for Clojurescript in Clojurescript so I can get a better sense of what it will and won't support in the future?

David Nolen

unread,
Dec 15, 2015, 2:01:04 PM12/15/15
to clojur...@googlegroups.com
There is no more work planned other than bug fixes. It is effectively done.

David

On Tue, Dec 15, 2015 at 1:39 PM, Zubair Quraishi <zub...@gmail.com> wrote:
Ok, makes sense. Is there a roadmap or something for Clojurescript in Clojurescript so I can get a better sense of what it will and won't support in the future?

Zubair Quraishi

unread,
Dec 15, 2015, 3:21:43 PM12/15/15
to ClojureScript
Ok, thanks for the update

Mike Fikes

unread,
May 14, 2016, 11:16:10 AM5/14/16
to ClojureScript

Hi Zubair,

Basic `core.async` constructs now work in self-hosted ClojureScript in the fork I've been messing with. See https://gist.github.com/mfikes/22f553d8c9186dcc613e1263ca9deeda

- Mike

Zubair Quraishi

unread,
Jun 24, 2016, 8:19:07 AM6/24/16
to ClojureScript
Will this fork make it back in to the main branch at some point?

mikef...@gmail.com

unread,
Jun 24, 2016, 8:55:25 AM6/24/16
to clojur...@googlegroups.com
Hi Zubair,

There are no plans on my part for pushing for that.

(My opinion: It is a relatively heavy set of code changes, useful only to a small portion of the community. If bootstrap becomes important enough where Cognitect would like to consider revising core.async for self-hosted use, at least Andare exists as a working example of how it can be done.)

- Mike

Zubair Quraishi

unread,
Jun 27, 2016, 4:58:46 PM6/27/16
to ClojureScript

i know I have been pushing for core.async to be pushed into master but I have since changed my mind as i have seen that running macros in bootstrapped clojurescript is very slow

Mike Fikes

unread,
Jul 5, 2016, 3:11:49 PM7/5/16
to clojur...@googlegroups.com

> i know I have been pushing for core.async to be pushed into master but I have since changed my mind as i have seen that running macros in bootstrapped clojurescript is very slow

Hey Zubair,

For a library of the size of `core.async`, I’d recommend making use of bootstrapped ClojureScript’s ability to cache the results of compilation. You can at least eliminate 95% of the start up time (with Andare). Here is an example (where the -K option to Planck enables caching):

$ time planck -Kc andare-0.2.0.jar -e"(require 'cljs.core.async)" -e"(require-macros 'cljs.core.async.macros)" -e"(cljs.core.async.macros/go)"
#object[cljs.core.async.impl.channels.ManyToManyChannel]

real 0m27.401s
user 0m36.093s
sys 0m0.940s

$ time planck -Kc andare-0.2.0.jar -e"(require 'cljs.core.async)" -e"(require-macros 'cljs.core.async.macros)" -e"(cljs.core.async.macros/go)"
#object[cljs.core.async.impl.channels.ManyToManyChannel]

real 0m1.505s
user 0m2.658s
sys 0m0.357s

- Mike

Zubair Quraishi

unread,
Jul 6, 2016, 11:57:37 AM7/6/16
to ClojureScript
Hi Mike,
I didn't necessarily mean that core.async is slow in my last comment, but more that macro evaluation can be slow. The clojurescript macro file in question is here:

https://github.com/zubairq/BlocklyBuilder/blob/master/src/webapp/framework/client/macros.cljs

It seems to take at least 5 seconds to compile in bootstrapped clojurescript. So are you saying that I can precompile and cache this file so that the browser never has to compile it?
thanks
Zubair

mikef...@gmail.com

unread,
Jul 6, 2016, 1:45:12 PM7/6/16
to clojur...@googlegroups.com
Yes. Look at the documentation for the cljs.js load function.
Reply all
Reply to author
Forward
0 new messages