This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-03
Channels
- # admin-announcements (6)
- # announcements (1)
- # beginners (17)
- # boot (69)
- # bristol-clojurians (1)
- # cider (7)
- # cljs-dev (115)
- # clojure (76)
- # clojure-russia (12)
- # clojure-sg (2)
- # clojurescript (152)
- # core-async (2)
- # core-logic (7)
- # cursive (18)
- # datascript (4)
- # datomic (2)
- # hoplon (12)
- # ldnclj (26)
- # off-topic (1)
- # re-frame (48)
- # reagent (6)
@martinklepsch: can you be more specific?
http://swannodette.github.io/2015/07/29/clojurescript-17/?utm_source=dlvr.it&utm_medium=twitter
@a.espolov: did you read the post?
@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.
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
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
?
@mcgivernsa: (def cors-allow-origin [#"(https?://)localhost(:\d+)?"])
@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
http://tools.ietf.org/html/rfc6454#section-7.1 Edit: Actually it might even be only one: http://www.w3.org/TR/cors/#access-control-allow-origin-response-header
step by step, I’m making headway w/ cljs.js . 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: https://github.com/clojure/clojurescript/wiki/Optional-Self-hosting). 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: https://github.com/mhuebert/cljs-bootstrap-async/blob/master/src/foo/core.cljs#L48
stacktrace: https://gist.github.com/mhuebert/9db93548eb29566094d6#file-stacktrace-eval-go-L7
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.
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
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.
I found my bug!
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 
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?
it’s just to populate the compiler state so validation, optimization, and static access to var info works
@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
so in order to know what pre-compiled JS files “means” you need to load an analysis cache for it
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?
Cool…was mostly just curious from the perspective of extending ClojureScript to other back-ends (Lua, in particular)
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
@jballanc: bringing other backends is a possibility but really there’s hardly any need to formalize emit*
@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:
https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL
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! http://wildermuthn.github.io/2015/08/02/clojurescript-and-the-blub-paradox/
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.
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"
@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 http://cljsjs.github.io
@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
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
@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
@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 https://www.npmjs.com/package/pattern-match
@roberto: well JS is popular because there were few other options on the front-end for more than a decade
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
@roberto: this library is mentioned in the article already
I mean funcy
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.
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.
@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.
roberto: exists http://www.smlserver.org/smltojs/
GHCJS is a thing (though it seems a bit heavy to me) and PureScript and Elm are lighter weight alternatives
yeah, I feel like a kid in a candy store …. with a stomach pain from so many goodies.
@scriptor: not source mapping, just a better debugging model overall but ClojureScript has that too
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.
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
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.
@dnolen: thanks
@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?
Hey everyone, I just opened a PR (https://github.com/gfredericks/test.chuck/pull/14) in test.chuck, adding ClojureScript support. Comments are very welcome