News for hackers. Stuff that matters.
Re:Macchiato: ClojureScript on the Server by WhatIsDukkha on Saturday December 03, 2016 @01:41PM (#13096860)
How viable would using this be from within clojurescript?

https://github.com/audreyt/node-webworker-threads

Re:Macchiato: ClojureScript on the Server by greenyouse on Saturday December 03, 2016 @07:28PM (#13098188)
It'd be doable but getting a nice Clojure-y API over it would take a little more work.

To start, you could try making a 1-to-1 mapping by closing over the web worker methods with cljs functions. To keep track of the web workers, you could put them in a cljs map inside an atom. This is what servant does to handle web workers.[0]

The other interfaces could be handled in a similar way by closing over methods with functions too.

It might be better after brute forcing a basic 1-to-1 style to create one or more layers of abstraction to make the interop more usable and Clojure-y. There could be cljs deftypes for the threads or web workers which hook into core cljs protocols[1] so that cljs.core functions would work over them. Macros could add syntactic sugar to lower level functions to make your API easier to use (looks like servant did that).

There are lots of options for how to build a good API depending on how powerful an abstraction you want to make for yourself. Getting basic support for the library could work by just closing over functions and adding some glue though.

[0]https://github.com/MarcoPolo/servant/blob/master/src/cljs/se...

[1]https://github.com/clojure/clojurescript/blob/master/src/mai...

Re:Macchiato: ClojureScript on the Server by vmorgulis on Saturday December 03, 2016 @04:04PM (#13097485)
21 contributors and the author is a famous programmer:

https://en.wikipedia.org/wiki/Audrey_Tang

Re:Macchiato: ClojureScript on the Server by spraak on Sunday December 04, 2016 @12:21AM (#13098896)
Professionally I have most often developed on Node but on the side have been really interested in FP. Applying FP ideas to JS is certainly possible, but this new accessibility of CS to my current world is exciting!
Re:Macchiato: ClojureScript on the Server by bmh100 on Saturday December 03, 2016 @04:05PM (#13097488)
Assuming a commercial web application, appropriately sized hardware, and correctly optimized code, when is "footprint" a significant disadvantage? How is "footprint" defined? When are startup times a significant disadvantage?
Re:Macchiato: ClojureScript on the Server by ledgerdev on Saturday December 03, 2016 @11:57PM (#13098846)
Here's a couple significant disadvantages to the jvm.

A simple jvm clojure app running jetting deployed as an uberjar takes about 12 seconds to start on a 1GB digital ocean vm.

Using jvm clojure as with aws lambda, it takes ~20 seconds for a cold start. Normal java is typically a couple of seconds, and it's likely that a cljs/node instance will be sub-second cold start.

Re:Macchiato: ClojureScript on the Server by dskrvk on Sunday December 04, 2016 @11:12PM (#13103316)
Note that with Lambda a cold start doesn't have to happen every time - if the function is executed frequently enough, the application will be kept around on the executing node.

Also, if your application has fairly stable load, then startup times are irrelevant 99% of the time, since you can just run persistent servers.

Re:Macchiato: ClojureScript on the Server by auvrw on Saturday December 03, 2016 @09:38PM (#13098540)
here, footprint is 'memory footprint,' the amount of main memory used by the application.

this is useful b/c VPSes are priced mostly based on memory

-----

i like that this says it's mostly trying to be "ring for node" ..

Re:Macchiato: ClojureScript on the Server by macco on Saturday December 03, 2016 @05:18PM (#13097773)
If you use Rasberry Pi, real-time web apps.

In most use cases the jvm will be superior.

Re:Macchiato: ClojureScript on the Server by dqv on Saturday December 03, 2016 @03:43PM (#13097413)
Please stop naming projects after drinks :(
Re:Macchiato: ClojureScript on the Server by spraak on Sunday December 04, 2016 @12:24AM (#13098901)
It's probably a play, similar to the name of CoffeeScript
Re:Macchiato: ClojureScript on the Server by yogthos on Sunday December 04, 2016 @08:52PM (#13102892)
I was going to base it on Express.js originally. Express and espresso were both taken on Clojars, so I that's how I ended up with macchiato. I later realized that I didn't need Express.js after all, but decided to keep the name.
Re:Macchiato: ClojureScript on the Server by spraak on Monday December 05, 2016 @03:12AM (#13104075)
Btw, I like the name and it's an awesome project
Re:Macchiato: ClojureScript on the Server by yogthos on Sunday December 11, 2016 @11:13PM (#13155481)
Thanks, I'm really enjoying working on it. :)
Re:Macchiato: ClojureScript on the Server by bsuh on Saturday December 03, 2016 @02:20PM (#13097057)
Can I write Clojure that gets compiled to JavaScript with ClojureScript and run that on JVM's JavaScript engine Nashorn?

Obviously turning code into JavaScript at least once is a mandatory requirement for fulfilling the "web" part of "web scale" and running the JavaScript on JVM gives me the "scale" part.

/snark

Re:Macchiato: ClojureScript on the Server by arohner on Saturday December 03, 2016 @02:34PM (#13097128)
I see the /snark, but I'll answer seriously.

Most JS code assumes it's targeting either a browser or node.js. Nashorn is very barebones, and can't pass for either. trying to run core.async on Nashorn didn't work for me because it expects either Window.setTimeout (which browsers use) or whatever-node-js uses for timers. I expect a large percentage of the libraries you'd want to use will be similarly affected.

Re:Macchiato: ClojureScript on the Server by emidln on Saturday December 03, 2016 @11:21PM (#13098775)
Yes. Recent cljs using the nashorn repl anecdotally performs as well as unprofiled and unoptimized clojure for a bunch of common stuff I've tested. Theoretically you could reexpose the missing parts of the JVM clojure api to cljs on nashorn given that most of the missing parts of clojure are written in java. That would let you have things like the STM if you wanted them.
Re:Macchiato: ClojureScript on the Server by patrickthebold on Saturday December 03, 2016 @10:57PM (#13098716)
Re:Macchiato: ClojureScript on the Server by harlanji on Saturday December 03, 2016 @06:50PM (#13098065)
Oracle started a project called avatar-js that aims to clone the Node runtime in Nashorn. I've only POC'd with it a while back, not run in prod.