Fork me on GitHub

How useable is Clojurescript on nodejs? last time I checked (long time ago), it was still experimental


#lumo is viable node.js citizen


So if I want to make a simple cross-platform SaSS, i wouldnt get too many headaches? :) I'm kind of disillusioned with other languages outside of clj at the moment

Christian Johansen09:10:59

I’m using cljs on node as we speak, pretty happy with it. did have some compilation issues with cljsjs packages, but the development experience is ace

Christian Johansen09:10:17

I use figwheel and CIDER 👌


I use #shadow-cljs. No problems running on Node, including using external (Node) libs.


Do you get a live REPL experience with production systems with node? Similar to how you can open a socket server for Clojure and start redefining things on the fly?


Lumo comes with OOB socket-repl. Maybe it could be used? Assuming you’d run your production build with Lumo.


That wouldn’t fly 🙂


no. you could maybe create something similar with self-hosted CLJS but nothing like that exists as far as I'm aware


hi guys, is it possible to build (via lein cljsbuild or a similar tool) a ClojureScript app with the output versioned? Kind of like Hugo does when you run it with serve:

<link rel="stylesheet" href="//localhost:1313/scss/style.min.aab96fff16f8025de8731d75970e04e0e4f02aaf4760749519be55d86efe0a6d.css">


@manuel There is a new feature on master, which I'm not familiar with, but sounds similar to what you describe: Perhaps it is worth trying.


thank you!

Logan Powell12:10:51

Why is `(clj->js <map with string keys>) turning just one of the string keys into a keyword? It's weird... only happens for strings with no spaces 😞


@loganpowell All of the keys are actually strings. Do js-keys on your result and you will see the truth.


You are simply seeing an artifact of printing, where it can't display keys with spaces as keywords

Logan Powell12:10:15

ah, ok, but when I js/console.log, I still get the keywords in there


Consider that #js {"a b" 1, :c 3} gets compiled to {"a b": 1, "c": 3}

Logan Powell12:10:47

ok, so I shouldn't worry about it?

Logan Powell12:10:57

this is for json interop


Perhaps your console log infrastructure is doing a similar thing to what ClojureScript does when using prn

Logan Powell12:10:26

ok, thank you!

Logan Powell12:10:07

The thing is, I will be returning the result to the user and if the keywords are sent over as anything but strings, the user may not know that they're not supposed to be strings

Logan Powell12:10:45

Sorry for the drag. I'll see what I can do with this


I’m not following the above, but the JSON.stringify result seems to illustrate how all the keys are rendered as strings in JSON.


From ClojureScript’s perspective, it can read and write certain keys as ClojureScript keywords in the JavaScript tagged literal format

cljs.user=> #js {:a 1 "b" 2 "c d" 3 "e/f" 4}
#js {:a 1, :b 2, "c d" 3, "e/f" 4}

Logan Powell13:10:21

I'm probably over-reacting... I'm creating a library that exposes a JavaScript API and arguments are translated to and from JS/CLJS. I am just worried that - since the JS args I'll be returning will have inconsistent key formats - that the user might get confused

Logan Powell13:10:05

I'm playing around with the returned object in a browser console and accessing either format works with the ["access an object key"] syntax, but of course - since there are spaces in those keys that are getting returned as strings with spaces - the user can't use the .accessor notation that is allowed for the ones that aren't


Right. The same thing would occur if your key happened to make it an invalid JavaScript identifier, right? As in "a-b"

Logan Powell13:10:50

you mean that the user would have to use object["a-b"]?

Logan Powell13:10:31

TBH, I abandoned JS for Clojure(Script) because I hated it


I’m not a JavaScript programmer, but I assume so. Otherwise object.a-b would essentially mean object.a - b

Logan Powell13:10:54

I just want to ensure that - if I return some args that happen to have nothing but single word keys - that the user won't set up any wrappers/functions that use the dot notation


I bet you need to avoid all of the strings in (js-keys js-reserved)

Logan Powell13:10:52

Perhaps I should just send it over js/JSON.stringifyed...

Logan Powell13:10:48

but it's a library, and the purpose of this particular response is to provide example arguments to the function

Logan Powell13:10:06

at least I know I'm not going crazy, so thank you very much for that 😄 I suppose I'll just have to make do

Logan Powell13:10:57

I can feel the yak shavers in my hand


I’m using extend-protocol to implement a protocol for a bunch of types


one of the JS types I need to apply it to is a Symbol


is there any docs on how to do that?


I’d like to avoid a catch-all object implementation if possiblee


(extend-type js/Symbol ...) should do it


@loganpowell {foo: "bar"} is identical to {"foo":"bar"} as far as JS is concerned. it just happens to print JS objects without quotes (when it can). no such thing as keywords in JS


ah, for some reason I recalled that extending js/<Type> was a no-no


it can be tricky in some cases but Symbol should be fine


:thinking_face: it seems to break


I’m using it to try and detect React’s Fragment element, which is a symbol under the hood. extending the type looks like it causes the internal check to fail in React


React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object


logging it shows that the symbol ends up boxed, which is probably why


goog.typeOf(Symbol()) is “symbol” but it looks like I can’t use that in extend-protocol


does anybody know how to translate it into clojurescript?

const img = new Image()
img.onload = () =>

Dustin Getz18:10:16

From a cljc file I want to use clojure.core.match/match from CLJ and /match* from CLJS, what is the best way to do this? Hard to abstract over because "can't take value of a macro" and match is variable arity


@alexandra.lysenko something like (let [img (new js/Image)] (set! (.-onload img (fn [] ...))))

Christian Johansen19:10:16

@dustingetz create a small wrapper-function in reader conditionals


ClojureScript master is currently in good shape for release, with no more changes planned. If we can't find any bugs in it, it may be the one that ships.

🎉 12

Giving it a go. Everything's compiling fine but I'm getting "Maximum call stack exceeded" errors from specter's use of subvec. Those didn't happen in 1.10.339.


Okay, it's a bug in Specter and it has been fixed in Specter's master.


@U04VDQDDY Just tried it on my project, looks like some project namespaces are missing on classpath. Doesn’t happen with 1.10.339 :thinking_face:


@U0FR82FU1 Would need a minimal repro; ClojureScript doesn't form the classpath but perhaps something regressed with consuming it?


yeah, unfortunately it’s a closed source. let me see, maybe I can share something in DM


@U04VDQDDY ok, that was NPM dep and the problem was with changed default value :npm-deps compiler option 😐


Ahh, cool.


In our case we have NPM deps declared in package.json + :npm-deps true which was default


Yes please