3 ms·
Compiling ClojureScript to JavaScript doesn't yield anything too surprising, and that's great. But core.async does some amazing stuff to actually analyze the c
by jcromartie 13y ago
Compiling ClojureScript to JavaScript doesn't yield anything too surprising, and that's great.
But core.async does some amazing stuff to actually analyze the code inside a "go" block and recompile it as a state machine so that a single thread can be "parked" and resumed. This allows core.async to work without multiple threads. It does this all at macro expansion time. This is the sort of thing that really demonstrates the power of Lisp. There's no way to do this without modifying the compiler in a language without a macro system.
So the output of a core.async program is going to be startlingly different than a normal ClojureScript program, because of the way it takes your "go" blocks apart and rewrites them when the macro is expanded.
Here's an example.
https://gist.github.com/jcromartie/5991947 https://gist.github.com/jcromartie/5991947