Quantcast
Channel: In.mesh: one step closer to threads on the web :fireworks:
Viewing all articles
Browse latest Browse all 15

In.mesh: one step closer to threads on the web :fireworks:

$
0
0

Either all the variables one references must be compiled beforehand, available to both sides of the invocation, or one must ship it over via the implicit or explicit binding.

(let [my-fn (fn [x] (+ x 2))]
  @(in :w1 (my-fn 1)))
;=> 3

That will work because the fn we’re implicitly shipping is pure cljs, which isn’t referencing anything else not known on the other side.

(def my-fn (fn [x] (+ x 2)))
@(in :w1 [my-fn] (my-fn 1))
;=> 3

Here we had to explicitly send my-fn over in the optional explicit conveyance vector. If my-fn is in an ns that is compiled on both sides of the invocation though:

@(in :w1 (my-fn 1))

Will just work.

Read full topic


Viewing all articles
Browse latest Browse all 15

Trending Articles