This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-31
Channels
- # aleph (1)
- # announcements (2)
- # beginners (105)
- # braveandtrue (1)
- # cider (61)
- # clara (47)
- # cljdoc (29)
- # cljs-dev (5)
- # clojure (61)
- # clojure-austin (14)
- # clojure-brasil (1)
- # clojure-india (3)
- # clojure-italy (4)
- # clojure-mexico (1)
- # clojure-nl (2)
- # clojure-spec (37)
- # clojure-uk (95)
- # clojurescript (73)
- # cursive (12)
- # data-science (1)
- # datomic (26)
- # duct (10)
- # emacs (5)
- # fulcro (47)
- # hoplon (6)
- # hyperfiddle (3)
- # jobs-discuss (3)
- # kaocha (2)
- # leiningen (3)
- # nrepl (8)
- # off-topic (3)
- # onyx (2)
- # re-frame (31)
- # reitit (16)
- # shadow-cljs (36)
- # spacemacs (46)
- # specter (16)
- # tools-deps (13)
- # yada (22)
How useable is Clojurescript on nodejs? last time I checked (long time ago), it was still experimental
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
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
I use #shadow-cljs. No problems running on Node, including using external (Node) libs.
many thanks
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.
all you need is a socket and eval. https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/repl/node_repl.js#L76
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: https://dev.clojure.org/jira/browse/CLJS-2903 Perhaps it is worth trying.
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
ah, ok, but when I js/console.log, I still get the keywords in there
ok, so I shouldn't worry about it?
this is for json interop
Perhaps your console log infrastructure is doing a similar thing to what ClojureScript does when using prn
ok, thank you!
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
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}
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
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"
you mean that the user would have to use object["a-b"]
?
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
right
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
Perhaps I should just send it over js/JSON.stringify
ed...
but it's a library, and the purpose of this particular response is to provide example arguments to the function
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
I can feel the yak shavers in my hand
@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
@thheller thank you!
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
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 = () =>
/somecode/
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 [] ...))))
@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.
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.
@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 😐
In our case we have NPM deps declared in package.json + :npm-deps true
which was default
Give it a spin using https://clojurescript.org/community/building