Fork me on GitHub

@martinklepsch: can you be more specific?


@dnolen: David i understand that cljs is now available to eval?


@a.espolov: did you read the post? simple_smile


covers the release


but in your post I haven't found any example code, only working version)


It is not difficult to educate?)


@a.espolov: other people can work on the documentation bits


it’s really not for normal usage, at this point still requires somewhat advanced understanding of ClojureScript to work through potential issues


@a.espolov: if you still want to try it yourself than read through cljs.js there are examples at the bottom of the source file.


Extreme cljs noob question: what is the current state of the art for using figwheel from emacs? The last set of instructions I found suggested that NREPL-and-clojurescript was in a state of flux, and indeed :figwheel { :nrepl-port foo } did not work as expected.


Or is figwheel no longer The Thing?

Petrus Theron10:08:50

Trying to set up sente for my http-kit project. Followed the readme, but getting a bunch of Invalid frame header errors in console on connection:

WebSocket connection to '' failed: Invalid frame header


@joelgluth: figwheel works great tons of people use it. Getting anything ClojureScript related working with Cider still seems like an exercise in extreme patience.


Thanks for the heads-up - it's definitely cool. I'm making do with running lein figwheel from an Emacs shell with paredit at the moment and it's getting me where I need to go simple_smile

Petrus Theron10:08:34

Having a hard time getting sente to work on an http-kit project where the front and backend run on different ports (3010 and 3011, respectively). Is there some CORS magic I need to be aware of, or perhaps something to do with CSRF tokens? I see the following console error:

XMLHttpRequest cannot load . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.
However, I have CORS middleware set up as:
(wrap-cors :access-control-allow-origin cors-allow-origin
      :access-control-allow-methods [:get :put :post :delete])
, which the sente handshake seems to be bypassing. So I tried returning CORS headers explicitly in ajax-get-or-ws-handshake-fn, but no luck. Feels like there should be a simple solution. Any help would be appreciated!


what is cors-allow-origin ?

Petrus Theron11:08:35

@mcgivernsa: (def cors-allow-origin [#"(https?://)localhost(:\d+)?"])

Petrus Theron11:08:11

@mcgivernsa: I tried adding another entry for #"(ws://)localhost(:\d+)?", but same cors error.


@petrus: It looks like you don't set the Access-Control-Allow-Origin in your HTML response


step by step, I’m making headway w/ cljs.js simple_smile. I’m now able to evaluate inside an existing namespace in my project by loading its analysis cache (as @dnolen describes for ‘cljs.core here: I can use def'd and referred vars, however a macro (eg. go) causes a Cannot read property 'findInternedVar' of null error in cljs$analyzer$macroexpand_1. code: stacktrace: there’s obviously a lot I don’t understand about how cljs.js works - I must be missing something with how macros are loaded/run.


@mhuebert: yeah that approach will not and cannot work


you need to wrap your head around the fact that the thing that generates the bootstrapped thing … is not the bootstrapped thing at all


just because you require go for the build, this won’t supply go for runtime macroexpand

Petrus Theron13:08:16

I'm fighting a weird ClojureScript code reload issue. On initial load, my cljs app is semi-broken with no errors, but as soon as I touch a particular utility file and the code reloads, my app works. I'm using boot with reagent and re-frame, but I don't know if this problem is me being an idiot (most likely), some swallowed compilation error or something particular to boot 😕.


@petrus getting familiar with how to make builds w/o lein or boot can help determine where the issue lies.

Petrus Theron13:08:38

I found my bug!

Petrus Theron14:08:41

My bug was keyword namespace mangling. I was doing this:

(let [resp-key (keyword (str (name path) "/response"))]
    ... ;; do stuff with resp-key)
However, if path is :users/load, then resp-key would become :load/response instead of :users/load/response as I expected. By reloading the code, the most recent keyword would override my re-frame handlers simple_smile.

Petrus Theron14:08:39

Can keywords in clj/cljs contain multiple slashes, i.e sub-namespaces?


@dnolen: it makes sense to me that the two things are separate. I didn’t understand that the analysis cache would include everything except macros. So the necessary step seems to a *load-fn* to supply the source files requested when evaluating (:require-macros [cljs.core.async..]). since core.async.impl/ioc_macros.clj imports java.util.concurrent.locks Lock, is it even possible to use core.async macros in bootstrapped cljs?


@mhuebert: the analysis cache isn’t about code


it’s just to populate the compiler state so validation, optimization, and static access to var info works


macros cannot exist there


@dnolen: I see. is it correct to say that when I load the analysis cache of a namespace in my build, the compiler state becomes ‘aware’ of it?


the issue is that for code size reason we don’t put this information into the generated JavaScript


it’s erased


so in order to know what pre-compiled JS files “means” you need to load an analysis cache for it


unless of course you compile / analyze the ClojureScript source directly


but that’s of course much slower than just eval’ing the JS and reading a cache


so analysis cache’s are completely inert - just data, they don’t represent anything executable


out of curiosity, what’s the current status of tools.emitter.{jvm,js} and the potential of moving ClojureScript to using something like that?


@jballanc: probably not going to happen


but that doesn’t really pass any judgement on the utility of such projects


Cool…was mostly just curious from the perspective of extending ClojureScript to other back-ends (Lua, in particular)


…especially now that we’re self-hosting


seems easy enough to patch emit* and friends directly, but wanted to make sure there wasn’t a more “formal" mechanism in the plans for the future


@dnolen: for a macro, then, reading .clj source directly is the only way to use it


& so core.async macros will need some work before they can be read in cljs.js


@jballanc: bringing other backends is a possibility but really there’s hardly any need to formalize emit*


very little in cljs.compiler is reusable


@mhuebert: it may I haven’t really thought much about cljs.core.async.macros in this context.


has anyone had trouble getting a repl working in Cursive for a figwheel project? I am following the directions here:


and it works, but after a minute or so it quits, saying: "No nREPL ack received". Also, for the minute or so that the prompt is displayed, I can't click into the window (this may be just me not understanding intellij)


I wrote an article yesterday, "Clojurescript and the Blub Paradox.” Would love to get informed criticism/feedback before I release it into the wild. No doubt I’ve made some mistakes or misassumptions!


well-written. dunno about comparing enthusiasm for lisp with being ‘religious’ since religious to me has implications of elevating a flawed way of thinking absent rational analysis. simple_smile


I like the contrasting lists of problem solving steps. I'd love to see comparisons like that over a whole host of languages/problems. "See this, and my mind goes there"


the thing I have not seen much about — though I guess I could Google — is integration between cljs and javascript. Is it easy/trivial?


one of the biggest value props of cljs is that these many many js libs are there to be used.


@wildermuthn: enjoyed reading it, thanks. typo in "intelligable" simple_smile


@jeremyraines: you are skipping a step. It says what REPL option to use


@mikepence: random JS libs aren't that important due to Google Closure Library


For the others integration for the popular ones exist


@wildermuthn: I'm not huge fan of the Paul Graham Blub narrative :) I think it makes people defensive about their existing tools


I have it on use clojure.main in normal JVM process with the associated script/repl.clj and changes to project.clj


@wildermuthn: a more complex example might show how clojure makes hard things easier


@jeremyraines: then that error isn't possible


Thanks for the feedback! Paul Graham can definitely be abrasive, but though it might gather more attention being provocative.


ok. so I want to confirm but I'm hitting a wall from my newness to intellij. It seems I've "lost" the running repl window -- I have a green play button in the top, but when I push it now it says I already have a repl running on that port. (and my browser console says it's connected)


I found and killed the running repl process, and I'm still getting that error


@wildermuthn: being a little bit provocative is good. But the ClojureScript story is really about system building


the mainstream equates “front-end” with JavaScript, some separate consideration


whereas in the Clojure world we have all pieces for the various parts of the system we want to build


you often people talk about ClojureScript as if it’s really a separate thing from Clojure


but it isn’t the way JavaScript is something different from your back-end language


the surveys reflect this - everyone using ClojureScript is using Clojure already


@jeremyraines: You might have better luck in #C0744GXCJ - I have found the repl stuff in cursive to be really solid, fwiw.


thank you, i'll check in there


@dnolen: so putting more focus on Clojure being full-stack?


yeah, i feel close . . . in fact that repl that I had to kill seemed to be doing the right thing, but I can't see myself start it and see it succeed for some reason, so I'm not sure how i launched it 😕


@wildermuthn: I consider that the real story, for me it’s really liberating to have multithreaded server-side language and lose very little in terms of other semantics when switching to the front-end


I never know whether to use the words Clojure or Clojurescript when I’m talking about it. I often want to write Clojure(Script).


@wildermuthn I like the article. Maybe including a mention of where the match macro is coming from would steer people into learning a little more about how that works


(Assuming it's core.match)


@wildermuthn: I'll read through it again this evening and send you some more feedback.


@wildermuthn: I like the ideas in the article, but if I had read at the time I didn't know Clojure, I think I would have dismissed it as too dogmatic. I have gotten the habit of running away from sentences like "technology X is superior to technology Y - period." - because in most scenarios when I encountered it (including from my own thoughts) it was a symptom of narrow-mindedness. Maybe a little more diplomacy to ease people into this kind of thinking simple_smile


@val_waeselynck: The article’s condescending-ish tone isn’t persuasive?? 😉 I appreciate the good feedback. Thinking on how to modify it to rely less on Blub.


@wildermuthn: I'm not sure a lot JavaScript programmers will be receptive to the switch vs condp thing - Several backend developers I know liked moving from say Ruby to NodeJs because it felt closer to the metal


Wow! Yeah, the tone is quite snobbish. If I didn’t know clj, it would turn me away from it. It is also one of the reasons I don’t like ruby (the snobbish tone of the ruby blogs). JS is easy. That is why it is popular. Oh, and JS has pattern matching


and I’ve seen some implemented with sweetjs also


@roberto: well JS is popular because there were few other options on the front-end for more than a decade


not because it was easy


I remember doing JS in 2005, it was terrible - as far from easy as one could possibly imagine


well “terrible” I mean I really enjoyed it - but it felt more like black magic than programming


yeah, I started enjoying it about 3 years ago. And my perception changed too.


@roberto: this library is mentioned in the article already simple_smile


When I started with CLJS, I saw it as the best parts of JS expanded; shared client/server language, dynamic, expressive, terse, fast. Plus first-class immutable data.


(that's not really true anymore)


I personally really enjoyed moving from Java to JavaScript (it was in 2013 though). I really felt like I had gotten rid of a lot of useless problems. To think that I could repeat this process from JS is what got me into Clojure I think.


I was attracted to CLJS because I took a course that introduced me to SML and Racket. I like both languages, and Cljs gave me the opportunity to use something as close to Racket in “real” apps.


I still enjoy doing JS, and would also enjoy writing SMLjs if there were one.


could always write it yourself 😉


I wish I could simple_smile


@roberto: Javascript might be the most practical programming language in the world, not because of the language, but because of its reach: browers, servers, phones, even embedded into hardware now.


there’s also an OCaml to JS thing and F# to JS thing as well


thank you for the black hole


yeah, I saw an F# to JS, but it required Visual Studio


GHCJS is a thing (though it seems a bit heavy to me) and PureScript and Elm are lighter weight alternatives


I’ve surveyed pretty much everything half-way serious


from what I can tell ClojureScript is way, way, way, way, way ahead


yeah, I feel like a kid in a candy store …. with a stomach pain from so many goodies.


elm seems to have a lot of good support regarding debugging and such


@scriptor: not source mapping, just a better debugging model overall but ClojureScript has that too


programming w/ immutable values works


ClojureScript has source mapping everywhere


How much did Clojure’s experience with being hosted on the JVM help in ClojureScript’s development with being compiled to Javascript? It seems like that should have given CLJS’s development a firm foundation, as opposed to other languages that might have been built without having a host platform in mind.


it supports every popular JS engine


most compile to JS things are not serious about this the way ClojureScript is


not going with NPM is partly what made this possible


Node.js has all the portability of the JVM


I get errors like this, any hint, where to look? "Warning: Don't set .props.om_init_state of the React component. Instead, specify the correct value when initially creating the element or use React.cloneElement to make a new element with updated props."


ordnungswidrig: om? i believe you can safely ignore it -- if memory serves, it's only relevant for javascripters


@nullptr: is this something in react recently? The only thing I changed (AFAIR) is upgrading some dependencies


i believe so, but don't recall the specific versions


Can I mute them in the chrome console somehow?


@dnolen I'm still using some non-standard tooling, but are there any tips in general for trying to debug source-mapping issues?


@ordnungswidrig: can’t mute unfortunately, in the future we’ll be able to avoid the warnings can’t in 0.13.X


@wildermuthn: Rich Hickey did the first version of ClojureScript so I suspect Clojure’s strategy was very present in his mind.


@pmooser: not sure what you are asking


@dnolen Sorry - when source-maps don't seem to be working, ie I just see js line numbers, are there are any recommended steps to figure out what in the process is failing, e.g. a way to find an indication that it can't find the .map files or something along those lines?


@pmooser: usually it’s something simple the path is wrong


there really not much to debug, the path needs fixing


Hey everyone, I just opened a PR ( in test.chuck, adding ClojureScript support. Comments are very welcome simple_smile


@nberger: cool! btw, Gary Fredericks the maintainer is more active on Clojure IRC if you want to get feedback from him directly outside of GitHub


@dnolen: Thanks! I'll try to find him there


@nberger: handle is gfredericks there too


@dnolen by the way, thanks for all the awesome stuff. Much of that PR is taken from your port of test.check to cljs simple_smile