Re: [ClojureScript] Scripting with Clojure(Script) : Plain Clojure ? Node.js ? Boot ? Planck ? Pixie ?

2015-08-26 Thread Julien Eluard
Hi Mike,

thanks for sharing those details! It makes much more sense now.
BTW congrats for all your work on Planck: it is quickly proving invaluable.

Cheers,
Julien

Le mer. 26 août 2015 à 11:06, mikefike...@gmail.com a écrit :

 Hi Julien,

 AFAIK there isn't any technical limitation preventing a similar effort
 built atop Node. In fact, Joel Martin has created a Node REPL based on
 self-hosting ClojureScript. See
 https://twitter.com/bus_kanaka/status/631252967987875840

 Why wasn't Planck created using Node? Planck was created on a whim—an
 experiment to see just how quickly it could launch:
 http://blog.fikesfarm.com/posts/2015-07-16-fast-javascriptcore-desktop-clojurescript-repl.html

 What about the long-term pragmatic aspects of Planck with respect to
 portability, Node, etc.? Those are mulled over here:
 https://gist.github.com/mfikes/c7da1e7dfded26c7ceb9

 - Mike


 On Aug 26, 2015, at 9:01 AM, Julien Eluard julien.elu...@gmail.com
 wrote:

 Hi Khalid,

 I agree with you that there is some potential here.

 Planck would be my favorite option but the OSX restriction and the lack of
 standard lib support probably will prevent me to use it.

 It makes me wonder why Planck has not been built on top of
 node.js/electron. It would offer free cross-platform support and access to
 the npm ecosystem. Are there any technical limitations that prevented it?

 Julien

 Le mar. 25 août 2015 à 10:52, Khalid Jebbari khalid.jebb...@gmail.com a
 écrit :

 Hi every one,

 Just starting this thread to gather feedback from people who used CLJ(S)
 to script and replace, you know, shell/Python/Ruby/Whatever. Pretty sure
 it's a dream to code AND script with CLJ(S). I know that it's possible to
 do it with CLJS backed by Node.js/io.js, with Boot somehow, with plain
 Clojure, with Mike Fikes' Planck (only OSX for now though), and Timothy
 Baldridge's Pixie which is not Clojure but quite close.

 If you use any or several, please post your feeback here. It's a nice
 time to CLJ(S) all the things :)

 --
 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 clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.

 --
 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 clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.

 --
 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 clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.


-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-26 Thread Thomas Heller
Well, while we are on the topic perhaps we should mention the downside of using 
Web Workers. For me it has been Data Transfer.

Since you can only transfer JSON type data between workers that usually meant 
you had to pr-str/read-string to roundtrip CLJS data. If you only have very 
small amounts of data that is no problem but read-string is not very performant 
and even something like 1mb of data will eat up enough CPU time to drop you 
below 60fps.

That might now be worked around with transit though since that is much faster. 
But still if you need to transfer a lot of data between workers you might be 
better of not using them. IE8/9 might also be an issue but even Microsoft 
suggest that you should not support those versions.

Oh and so far I have not seen support for workers in lein-cljsbuild and I 
haven't documented anything in shadow-build so building web worker javascript 
files might actually be something of a mystery to people. To be honest I never 
used them for anything other than toy projects either.

Anyways, I like them. Use them. It is not that hard. :)

Cheers,
/thomas



 
 Why the cynicism? Isn't it true that the only way to make use of multiple 
 cores in browser is to use WebWorkers?
 


-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-26 Thread Atamert Ölçgen
On Wed, Aug 26, 2015 at 2:46 AM, Mike Thompson m.l.thompson...@gmail.com
wrote:

 On Tuesday, August 25, 2015 at 7:45:28 PM UTC+10, Thomas Heller wrote:
  On Tuesday, August 25, 2015 at 10:59:53 AM UTC+2, Daniel Kersten wrote:
   The browser does not support threads so neither can core.async.
  
  
   To expand on that, core.async uses cooperative multitasking, which
 means you have to give control back every so often so it can schedule other
 go blocks to be run. Calls like ! will do this while they block (which is
 why timeout works).
  
 
  While that is correct let me emphasize that timeout is not a solution!
 
  Do you always know how long task X will run or whether you are going to
 need to chunk it? Is it even possible to split up? A task that may
 complete in 10ms on your machine might take 100ms on another one or even
 500ms on yours if the computer is doing something else.
 
  If you need to do CPU intensive work in the browser use a WebWorker. It
 is their purpose. While not perfect it is far better than trying to be
 cooperative in your code.
 
  My 2 cents,
  /thomas


 You have a problem, and you decide to solve it via webworkers.

 Later you'll WISH you'd chosen regexs instead :-)


Why the cynicism? Isn't it true that the only way to make use of multiple
cores in browser is to use WebWorkers?




 --
 Mike

 --
 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 clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.




-- 
Kind Regards,
Atamert Ölçgen

◻◼◻
◻◻◼
◼◼◼

www.muhuk.com

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-26 Thread Thomas Heller
On Wednesday, August 26, 2015 at 1:29:38 PM UTC+2, Daniel Kersten wrote:

 
 If you can use newer browser, you've got Transferrable Object to transfer 
 binary data with zero-copy.
  

True but I was talking about CLJS data which isn't binary.

 
 Agreed, its probably a bit of work. I guess that since each one has its own 
 JS context, the simplest way is probably to have two cljs projects: your main 
 code and your web worker code.
 

Actually you want to use closure modules so some code can be shared. With 2 
projects the client will download 2 separate instances of cljs.core which is 
quite heavy.

I have an example here:
https://github.com/thheller/shadow-build/tree/master/cljs-data/workers/src
https://github.com/thheller/shadow-build/blob/master/dev/build.clj#L6-L30

It is not a good example but the idea is to have one common module (cljs) and 
one for each client (ie. the page itself, worker1 and worker). worker1 (and 
2) will automatically load the cljs module which the browser already has 
available because the page did already load it.

But this is going too far off-topic. If anyone is actually interested in using 
WebWorkers I'd be happy to go into further detail on how that works in 
shadow-build.

Cheers,
/thomas

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-26 Thread Daniel Kersten
On Wed, 26 Aug 2015 at 11:36 Thomas Heller th.hel...@gmail.com wrote:

 Well, while we are on the topic perhaps we should mention the downside of
 using Web Workers. For me it has been Data Transfer.

 Since you can only transfer JSON type data between workers that usually
 meant you had to pr-str/read-string to roundtrip CLJS data. If you only
 have very small amounts of data that is no problem but read-string is not
 very performant and even something like 1mb of data will eat up enough CPU
 time to drop you below 60fps.


If you can use newer browser, you've got Transferrable Object to transfer
binary data with zero-copy.



 That might now be worked around with transit though since that is much
 faster. But still if you need to transfer a lot of data between workers you
 might be better of not using them. IE8/9 might also be an issue but even
 Microsoft suggest that you should not support those versions.

 Oh and so far I have not seen support for workers in lein-cljsbuild and I
 haven't documented anything in shadow-build so building web worker
 javascript files might actually be something of a mystery to people. To be
 honest I never used them for anything other than toy projects either.


Agreed, its probably a bit of work. I guess that since each one has its own
JS context, the simplest way is probably to have two cljs projects: your
main code and your web worker code.

There is Servant: https://github.com/MarcoPolo/servant
What it seems to do is run the same compiled cljs both as the main code and
the webworker code (with some setup/detection code to manage how it should
run). This way both your webworker and main code can call the same
functions. Communicating between them still happens through messages.
I've never actually used it, so my summary may not be great :)



 Anyways, I like them. Use them. It is not that hard. :)

 Cheers,
 /thomas



 
  Why the cynicism? Isn't it true that the only way to make use of
 multiple cores in browser is to use WebWorkers?
 
 

 --
 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 clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.


-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-26 Thread Antonin Hildebrand
I've got a fresh experience of refactoring my project to use web workers. Here 
is the story:

I'm building a code editor using web technologies[1]. The initial design was 
pretty simple and sweet. I decided to go with re-frame (thanks Mike!), which 
means UI driven by reagent and react with niceclean event 
processing/subscription system.

The editor is doing basically three things:
1) UI rendering and responding to user actions
2) analyzing source code (for syntax highlighting, etc.)
3) layouting source code for renderer to generate markup

I observed that analyzing and layouting is blocking my rendering tasks, so I 
decided to offload them to another thread using webworkers. What seemed like an 
easy change at first, introduced a lot of complexity later.

Problems encountered so far:
1) cljs-devtools[2] does not work from web workers, this is a major problem for 
my development workflow
2) data must be marshalled as JSON = wasn't that hard, started using transmit
3) instead of one app-db state and one queue of events, now I have it split in 
two, one in the worker and one in the main thread. Keeping them in sync can be 
tricky due to async worker nature. imagine undo/redo operations - those have to 
be executed on both databases at once.

To solve problem #1. I had to implement special development version of the app, 
which does not run a worker thread, but emulates it on the main thread. It does 
not sound that hard, except re-frame wasn't ready to provide me with two 
independent re-frame event queues in single javascript context. I had to 
rewrite it: https://github.com/Day8/re-frame/pull/107.

To make the long story short. One month later and wish I'd chosen regexs 
instead ;)

happy web-working! :)
Antonin

[1] https://github.com/darwin/plastic
[2] https://github.com/binaryage/cljs-devtools




On Wednesday, August 26, 2015 at 10:27:34 AM UTC+2, Atamert Ölçgen wrote:
 On Wed, Aug 26, 2015 at 2:46 AM, Mike Thompson m.l.tho...@gmail.com wrote:
 On Tuesday, August 25, 2015 at 7:45:28 PM UTC+10, Thomas Heller wrote:
 
  On Tuesday, August 25, 2015 at 10:59:53 AM UTC+2, Daniel Kersten wrote:
 
   The browser does not support threads so neither can core.async.
 
  
 
  
 
   To expand on that, core.async uses cooperative multitasking, which means 
   you have to give control back every so often so it can schedule other go 
   blocks to be run. Calls like ! will do this while they block (which is 
   why timeout works).
 
  
 
 
 
  While that is correct let me emphasize that timeout is not a solution!
 
 
 
  Do you always know how long task X will run or whether you are going to 
  need to chunk it? Is it even possible to split up? A task that may 
  complete in 10ms on your machine might take 100ms on another one or even 
  500ms on yours if the computer is doing something else.
 
 
 
  If you need to do CPU intensive work in the browser use a WebWorker. It is 
  their purpose. While not perfect it is far better than trying to be 
  cooperative in your code.
 
 
 
  My 2 cents,
 
  /thomas
 
 
 
 
 
 You have a problem, and you decide to solve it via webworkers.
 
 
 
 Later you'll WISH you'd chosen regexs instead :-)
 
 
 
 Why the cynicism? Isn't it true that the only way to make use of multiple 
 cores in browser is to use WebWorkers?
 
 
  
 
 
 --
 
 Mike
 
 
 
 
 
 --
 
 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.
 
 
 
 
 
 -- 
 
 
 
 
 
 
 Kind Regards,
 Atamert Ölçgen
 
 
 ◻◼◻
 ◻◻◼
 ◼◼◼
 www.muhuk.com

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Scripting with Clojure(Script) : Plain Clojure ? Node.js ? Boot ? Planck ? Pixie ?

2015-08-26 Thread mikefikes18
Hi Julien,

AFAIK there isn't any technical limitation preventing a similar effort built 
atop Node. In fact, Joel Martin has created a Node REPL based on self-hosting 
ClojureScript. See 
https://twitter.com/bus_kanaka/status/631252967987875840

Why wasn't Planck created using Node? Planck was created on a whim—an 
experiment to see just how quickly it could launch: 
http://blog.fikesfarm.com/posts/2015-07-16-fast-javascriptcore-desktop-clojurescript-repl.html

What about the long-term pragmatic aspects of Planck with respect to 
portability, Node, etc.? Those are mulled over here: 
https://gist.github.com/mfikes/c7da1e7dfded26c7ceb9

- Mike


 On Aug 26, 2015, at 9:01 AM, Julien Eluard julien.elu...@gmail.com wrote:
 
 Hi Khalid,
 
 I agree with you that there is some potential here.
 
 Planck would be my favorite option but the OSX restriction and the lack of 
 standard lib support probably will prevent me to use it.
 
 It makes me wonder why Planck has not been built on top of node.js/electron. 
 It would offer free cross-platform support and access to the npm ecosystem. 
 Are there any technical limitations that prevented it?
 
 Julien
 
 Le mar. 25 août 2015 à 10:52, Khalid Jebbari khalid.jebb...@gmail.com a 
 écrit :
 Hi every one,
 
 Just starting this thread to gather feedback from people who used CLJ(S) to 
 script and replace, you know, shell/Python/Ruby/Whatever. Pretty sure it's a 
 dream to code AND script with CLJ(S). I know that it's possible to do it 
 with CLJS backed by Node.js/io.js, with Boot somehow, with plain Clojure, 
 with Mike Fikes' Planck (only OSX for now though), and Timothy Baldridge's 
 Pixie which is not Clojure but quite close.
 
 If you use any or several, please post your feeback here. It's a nice time 
 to CLJ(S) all the things :)
 
 --
 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 clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.
 
 -- 
 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 clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: ISO lein-cljsbuild maintainer

2015-08-26 Thread Evan Mezeske
I'd like to congratulate and thank Maria Geller (https://github.com/mneise) for 
stepping up to take over maintainership of lein-cljsbuild. I'm very happy to 
see the project continue with an active owner.

https://github.com/emezeske/lein-cljsbuild/commit/b866dfa95df688fe83ffed2c758a4dc19b3fc100

Also, I'd like to thank Chas again for all his work on the project, and for 
taking care to make the hand-off go smoothly.

-Evan

On Monday, August 24, 2015 at 8:29:39 PM UTC-7, Evan Mezeske wrote:
 Thanks, Chas, for all the work you put into lein-cljsbuild over the last 
 couple of years. We could not have asked for a better maintainer. Things are 
 in great shape for when the next maintainer takes the reins.
 
 On Monday, August 24, 2015 at 8:29:18 AM UTC-7, Chas Emerick wrote:
  Hi all,
  
  As you might have noticed, lein-cljsbuild has been pretty quiet of late. 
  This is in part due to it being largely complete, and the stretch of 
  upstream stability provided by ClojureScript these days.
  
  The other factor is that I'm just very busy elsewhere. The big downside 
  of this is that I've clearly become a bottleneck to people effectively 
  using and patching lein-cljsbuild to effect straightforward bugfixes and 
  minor enhancements. More significantly, I've 'run out of gas' re: my 
  original intentions to significantly refactor the project in a simpler, 
  more modern direction. Largely, my stewardship of it has consisted of 
  maintaining stability and a certain amount of firefighting. That's 
  disappointing to me personally, but c'est la vie. :-)
  
  I've been in contact with Evan and David Nolen and made them aware of 
  the impending change. I just released `1.1.0` to clojars, which I'd like 
  to be my last release. I've also done a spring cleaning on the issue 
  tracker, and written up a set of recommendations for the next maintainer:
  
  https://github.com/emezeske/lein-cljsbuild/issues?q=is%3Aopen+is%3Aissue+label%3ARecommendation
  
  I would like to pass the baton on to someone that is familiar with both 
  ClojureScript (inside and out) and Leiningen. I will be available to 
  answer questions here and there as necessary, and to help get the new 
  maintainer up to speed, but I won't reasonably be able to guide anyone 
  to understanding how ClojureScript's internals work, nor how to develop 
  a Leiningen plugin.
  
  This is a good opportunity for someone to have a really positive impact 
  on the ClojureScript development experience. If you're interested and 
  available, please get in touch with me by email directly.
  
  Thanks,
  
  - Chas

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.