Fork me on GitHub
#clojure-europe
<
2021-10-22
>
RAMart06:10:24

Programming Clojure today! 💪 Surprisingly also in a defn conform unform context like @raymcdermott and also using @viebel's fix. :thinking_face:

borkdude07:10:27

Tell us more!

☝️ 1
RAMart08:10:25

It's about ClojureScript which gets compiled to JavaScript. I'd like to sit at my REPL on my machine and get code executed on a remote machine. It's about automation and I can't just start a REPL there and connect. Being at my REPL in the Clojure-World, calling a function suitable for automation, I'd like to compile this function and it's dependencies to a minimized JavaScript, send it to the remote machine, getting executed and get the result back.

(ns de.doctronic.testomatic.client.macros
  #?(:clj (:require [de.doctronic.testomatic.client.defnjs :as defnjs])))

#?(:clj

   (defmacro defnjs
     [& defn-form]
     (if (:ns &env)
       `(defn [email protected])
       `(defn [email protected](defnjs/inject-remote-call defn-form))))
)
(WIP)

borkdude08:10:56

@U1Z4D5SSV Is that REPL embedded in another application?

RAMart08:10:04

Already works for node.js and code getting injected in the browser.

RAMart08:10:19

@U04V15CAJ the REPL I'm working at? Yes.

borkdude08:10:39

Interesting! Someone has recently done something similar with #nbb on an embedded device. Nbb can start up a socket REPL or nREPL server (in pure JS) and you can connect to it, and evaluate more

RAMart08:10:11

I also need resources (like pictures). And the remote machine can either be Windows, Linux or macOS. So I need the project folder on the remote machine and shared with my local machine. We would also need two REPLs: One for the desktop, on for the browser, both sharing sources.

RAMart08:10:02

But thanks for the hint, @U04V15CAJ! I'll try to have a look. For some inspiration and food for thought.

borkdude08:10:55

The difference is that nbb is using SCI so you can interpret forms after compilation has already been done and there is no JVM REPL anymore (even in advanced mode)

borkdude08:10:37

so it's probably a different use case, but with some overlap

👍 1
🙇 1
raymcdermott08:10:36

In CLJ it all works but fails badly in CLJS as the specs in cljs.core.specs.alpha are only available to macros (ie on the Clojure side)

raymcdermott08:10:27

I ended up stripping out the defs and copying them to a project ns. A terrible hack but @U04V15CAJ made me do it 😝

raymcdermott08:10:12

you should know that I found a bug in sequence destructured args that Yehonathon fixed yesterday

borkdude08:10:17

I've seen worse hacks

raymcdermott08:10:16

hehe jk me too

raymcdermott08:10:34

@U1Z4D5SSV the update to the code from Yehonathan is at https://github.com/viebel/defntly

🙇 1
raymcdermott09:10:45

(23 stars now)

dharrigan06:10:41

Good Morning!

littleli07:10:27

waving Good morning everyone!

borkdude13:10:57

Preview of sitefox on nbb, a Node.js + CLJS framework.

npm init sitefox-nbb mywebsite