This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-18
Channels
- # admin-announcements (59)
- # beginners (5)
- # boot (99)
- # cider (9)
- # clojure (207)
- # clojure-czech (1)
- # clojure-dev (28)
- # clojure-france (3)
- # clojure-italy (1)
- # clojure-japan (22)
- # clojurescript (234)
- # core-async (12)
- # datascript (1)
- # datomic (60)
- # funcool (137)
- # hoplon (18)
- # instaparse (2)
- # jobs (2)
- # ldnclj (42)
- # ldnproclodo (3)
- # liberator (13)
- # off-topic (21)
- # onyx (2)
- # re-frame (5)
- # reagent (12)
- # ring-swagger (5)
- # testing (17)
I’m sticking a reference to js/JSON
behind a reader conditional and the compiler is complaining about “no such namespace js"
@mattly: yep, you’ve got it
This might be helpful http://danielcompton.net/2015/06/10/clojure-reader-conditionals-by-example (shameless self promotion)
@danielcompton: I read that several days ago and thought it was really well-done, so keep promoting it
@danielcompton: maybe you want integrate your article into the clojurescript-unraveled book (http://funcool.github.io/clojurescript-unraveled/)?
im playing with clojurescript on ec2 w more than 8 cores and it seems only 8 core is used. is there any way to up it somehow? JVM_OPTIONS maybe?
@niwinz: how would you envision it being added? Just another chapter, or a link in the appendix or further reading?
I think that the best way now,... is adding it as appendix entry. Later, we can transform it to be part of the reader chapter
I’l have to think about it, I’d probably want to edit it to make it more cljs specific
I’ve put it on the todo list
Thank you very much. Having similar content to on the book will be a great point of reference on reader conditionals 😄
Is there a defacto way of handling asynchronicity in Cljs apps, like there is promises in Javascript ES6 (and callback hell in Node/ES5)?
core.async is a bit low level in itself, but I see both FRP libs and Promises built on top. Just wondering what people are using
I think there no defacto standard. I have done this package for facilitate the usage of promises in cljs (https://github.com/funcool/promesa)
You can use cats library for make the promises composition more likely the ES6 async/await
@niwinz: that looks very cool. do you have any examples where you combine core.async with promises?
@grav I'm not undertand properly your question. You can use core.async for communicating processes and promises for asynch results (api calls or somethig similar)
ah, ok. i think i follow. it’s the api calls that’s my main problem. I used promises when doing es6, so I’m sure promesa will be familiar
Anyone recommend an approach/lib for embedding stylish charts (such as d3) into an Om/react webapp?
jonpither: here's an example for highcharts : https://github.com/trampoline/clustermap-components/blob/master/src/clustermap/components/timeline_chart.cljs
@mccraigmccraig: thanks also
clojure.lang.ExceptionInfo: Could not locate cats/core__init.class or cats/core.clj on classpath: at line 26 file:/home/grav/.m2/repository/funcool/cats/0.5.0/cats-0.5.0.jar!/cats/core.cljc {:tag :cljs/analysis-error, :file "file:/home/grav/.m2/repository/funcool/cats/0.5.0/cats-0.5.0.jar!/cats/core.cljc", :line 26, :column 1}
at clojure.core$ex_info.invoke(core.clj:4403)
at cljs.analyzer$error.invoke(analyzer.clj:380)
at cljs.analyzer$analyze_seq.invoke(analyzer.clj:1859)
at cljs.analyzer$analyze$fn__2126.invoke(analyzer.clj:1953)
This is caused by the dependency conflicts, some of your packages are requiring cats 0.5.0 y other some 0.6.1 and them both are incompaibilities
I'm having a hard time with Sente. I followed the instructions to the letter, but when my cljs frontend connects to my backend, all I see is a slew of these errors:
.
Could it be related to running sente on a different port (localhost:3011) from the origin of my HTML (localhost:3010)?
So Chrome throws Invalid frame header and Safari throws Compressed bit must be 0 if no negotiated deflate-frame extension
when sente attempts to connect.
@niwinz: I get this:
clojure.lang.ExceptionInfo: clojure.lang.Symbol cannot be cast to clojure.lang.Namespace at line 25 file:/home/grav/.m2/repository/funcool/promesa/0.4.0/promesa-0.4.0.jar!/promesa/core.cljs {:tag :cljs/analysis-error, :file "file:/home/grav/.m2/repository/funcool/promesa/0.4.0/promesa-0.4.0.jar!/promesa/core.cljs", :line 25, :column 1}
at clojure.core$ex_info.invoke(core.clj:4403)
at cljs.analyzer$error.invoke(analyzer.clj:380)
at cljs.analyzer$analyze_seq.invoke(analyzer.clj:1859)
at cljs.analyzer$analyze$fn__2126.invoke(analyzer.clj:1953)
at cljs.analyzer$analyze.invoke(analyzer.clj:1946)
at cljs.analyzer$analyze_file$fn__2177.invoke(analyzer.clj:2190)
at cljs.analyzer$analyze_file.invoke(analyzer.clj:2185)
at cljs.analyzer$analyze_deps.invoke(analyzer.clj:1262)
maybe that was the problem all along. lein deps :tree
didn’t yield any other dependency on cats
other than 0.5.0
@grav: we are using http://hoplon.io which solves reactivity using a small data-flow library called Javelin https://github.com/tailrecursion/javelin/ and connects to backends using https://github.com/tailrecursion/castra/ (which uses transit as its transport layer) Since then we didn't have to fuck around with callbacks or promises AT ALL.
Is something like Sierra's Component library the best way to manage a CLJS app, specifically when it comes to sharing or passing config in a DRY manner?
@onetom: thanks, I’ve heard a brief cognitect podcast about it, but I haven’t dived into it yet.
react's lifecycle management can get quite complicated. javelin + hoplon offers a loooot lot lot simpler yet similarly powerful way of dealing with reactivity...
cool. but where react only concern itself with the view part, hoplon sounds a bit more framework-y,
why does (identical? :x :x)
is false
in ? I understand why it is technically, but I assume that true
is expected behavior. Or Clojure's language spec leaves this moment undefined?
@grav: u can hop on the #C08BDAPRA channel for further discussions. u wont regret it 😉 btw, here is a piece of code we open sourced which is a nice show case of hoplon: https://github.com/exicon/homepage/tree/hoplon6 we are just migrating it to the latest version of it.
Anyone got Cider + clj-refactor working to clean up cljs ns forms? It kills my Emacs
@jonpither: Rumours has it that http://github.com/expez is working on it as we speak.
(-> (p/promise {:foo 2})
(p/then (fn [r]
(println "type: " (type r))
(p/all [r])))
(p/then (fn [[r]]
(println "type: " (type r)))))
This yields:
type: cljs.core/PersistentArrayMap
type: #object[Object "function Object() { [native code] }”]
If I use
(-> (p/promise {:foo 2})
(p/then (fn [r]
(println "type: " (type r))
r))
(p/then (fn [r]
(println "type: " (type r)))))
the all operator just collect the result of all promises in one array and resolves the resulting promise with that array
i’m using p/all a lot since i want to carry over my results from previous then’s. Maybe it’s not idiomatic?
Currently my code looks something like this:
(-> (async1)
(p/then (fn [r1]
(p/all [r1 (async2)])))
(p/then (fn [r1 r2]
(prn r1 r2))))
Seems my use case is this: http://stackoverflow.com/questions/28250680/how-do-i-access-previous-promise-results-in-a-then-chain
though spread seems to have the same problem, converting my persistent arraymap into a js object
For the use case that you are explaining you should use (-> (async1) (p/then (fn [r1] (p/all [r1 (async2)]))) (p/spread (fn [r1 r2] ...))
But the best way to do it is just (-> (p/all [(async1) (async2)]) (p/spread (fn [r1 r2] ...))
If you have an async operation that depends on the result of other, the best way is use cats mlet
(require '[cats.core :as m])
(m/mlet [r1 (async1)
r2 (async r1)]
(some-operation r1 r2))
The mlet return value is an other promise that will be resolved with the last expression on the block.
Take a look in the documentation examples on the spread http://funcool.github.io/promesa/latest/#parallelism
Are any of you using ClojureScript + Node.js (or Io.js) on the server-side instead of Clojure + JVM ?
sdegutis: not yet, but I am looking into this currently in combination with aws lambda
sdegutis: I started playing with this template: https://github.com/swannodette/mies-node-template
I'd be interested if there was eventually a way to move away from Leiningen altogether and just use npm for all ClojureScript dependencies and gulp/etc for build needs.
@sdegutis: you can move away from leiningen altogether as long as you are willing to manage your jars dependencies for yourself
if i recall correctly the mies-node-template was deprecated because "no time to mantain two mies templates" so the node part was added to the main mies. luckly @maria stepped up and started mantaining the main mies
@bensu: I was kind of hoping that ClojureScript would move entirely away from jars at some point, and be a pure JavaScript lib that only uses JS ecosystem tools.
@sdegutis: paraphrasing others "that will never happen" but I agree with @nullptr and do think there is place for a JVM-free ecosystem, specially targeted towards build tools and command line programs. Targetting browsers is very hard without the Google Closure Compiler.
It seems like Immutable.js + ES6 + Sweet.js gets pretty close to doing exactly what ClojureScript offers. A little wrapper library to pull them altogether could probably look almost identical to ClojureScript code.
Macros, destructuring, immutable data structures, these seem like the killer features of ClojureScript. Am I missing anything?
nicely integrated google closure should not be underestimated — both the library and the compiler
emphasis nicely integrated — it’s accessible to js developers today, but nobody uses it because it doesn’t fit the toolset
oh, and this stuff is mostly years old and stable … and the tooling around it is sane
@nullptr: Good point about core.async. Hiccup could probably be reproduced using the aforementioned combination (ES6, Sweet.js, Immutable.js). I'm pretty sure general JS community consensus is that the Google Closure library and compiler are terribly designed and should be avoided, and I agree with their reasoning.
The general JS community consensus re: Google Closure is “what’s that?” and “looks hard”. The notion that either are terribly designed or should be avoided is silly.
@sdegutis: when it comes to design I don't listen to the Js community. The Google Closure compiler makes ClojureScript practical for browser use, and the modules make things like Figwheeel possible so we generally like it here
@nullptr: Okay maybe I shouldn't speak for the whole community then lol. Either way, I think it's not a great design. In fact I'm quite a bit biased against everything they've done except web search and gmail.
Okay maybe "sucks" is a bit harsh. But for a company of their stature, they could do better.
Closure is perhaps only one of mentioned techs used in search and gmail
@sdegutis: I’d say it’s not great? their python code is hell of unidiomatic, at least
also the fact that they seem to have like, 9 different build systems isn’t exactly encouraging
@swizzard: only 9 build systems for a company so large is pretty awesome achievement.
Okay, thanks for adding to the list of anecdotes that confirms my bias against Google's development tools and code.
@swizzard: If you wander into a large software development company, you'll often find dozens of build systems, often used by a single team.
It definitely messy and unmanaged. However keeping 0.0002 build systems per employee is still pretty awesome.
How does symbol resolution work? I have tested that (:require [foo :refer [bar]])
does not create var bar in a current namespace, and `bar resolves to foo/bar, but how does it work?
@juhoteperi: did you figure out what was causing that src
/`src2` issue with cljs.test?
@pandeiro: No, but I found a way to reproduce it with pure cljs: https://github.com/Deraen/problems/tree/cljs-changes-problem
@juhoteperi: I saw that, nice work! I don't have time to investigate now, and adding :init-fns
solved the stale test issue with boot-cljs, but I hope to revisit this
I guess I was just wondering if you feel pretty confident the issue is in cljs itself?
@pandeiro: Looks like the problem is reproducible even without cljs.test
@juhoteperi: is it just any time there's multiple source directories? it's surprising
Could be related to :main ns being on different directory
Or well, :main ns shouldn't be any different.
Strange, after compilation compiler-state contain the new var
I guess if core-ns macro-expansion is done before test-ns is reanalyzed it could cause this
@juhoteperi: try using (build/inputs "src" "src2")
build/inputs
is in the cljs.build.api
namespace
@spinningtopsofdoom: Thanks.... that indeed fixes the problem
NP I only found it by looking through David Nolens builds to find out a way to replicate cljsbuild. It could definitely use better documentation.
I thought build source only mattered for main namespace, as I did some testing and couldn't find any reason to list other source dirs
And I wrote that down on boot-cljs comments so I though it was documented behavior 😄
@pandeiro: https://github.com/adzerk-oss/boot-cljs/commit/6329cd19e0a9bf82e69b7f426eaa020c080740b6 should work now
has anyone been working on node.js applications with clojurescript?
also, is core.typed usable with clojurecript?
@joelmccracken: I have recently compiled cljsfile and ran it on Node.js. Not sure about core.typed
did you have to do anything funny?
not much
thanks
Is there a way to run Node-backed REPL without creating a project? Similar to lein repl
, that can be used everywhere. I'd expect something like lein --plugin=lein-noderepl trampoline noderepl
.
@juhoteperi: @spinningtopsofdoom: thanks so much for the fix! awesome
I have a powerful desktop computer at home that I'd like to use remotely via my chromebook. I have everything set up, however I'm not sure how figwheel works exactly... With lein figwheel running and changing code: Desktop: localhost:3449 gets updated Chromebook: [my ip]:3449 I can load the page but no figwheel updates happen Can this be made to work at all? Thanks for any input.
@pandeiro: You're welcome
@not-much-io: you could use ssh port forwarding to achieve remote access to your home desktop
domkm: ping?
domkm: do you have a couple of minutes to answer a question?
domkm: oh, thanks
Today at the London Project Clojure Dojo we were trying to figure how to do server side rendering of a SPA and we arrived at your omelette which we successfully run on our own machines.
@malcolmsparks: I have already achieved remote access for emacs and to to the port I want to observe the web app on. The problem is that the web app is not getting updated on the chromebook while it does get updated on the localhost.
domkm: we found out how you are doing the server-side rendering but when we tried to apply it we got an error about document not being defined, from the javascript engine. I was wondering, before I go in a witch hunt, if this rings any bell? Our generated JS is quite different to your JS.
pupeno: document
is not defined in Nashorn. neither is window
or many of the objects in a browser JS environment.
domkm: how do you work around that in omelette?
@pupeno: not omelette but i've worked around that issue -- there's an example here: https://github.com/pandeiro/agua
pupeno: Leave all the rendering and DOM stuff to React. Try not to do any of it manually. When you have to access browser APIs, put that logic in lifecycle methods that only run in the browser, like componentDidMount
.
domkm: mh, ok, I’ll look into that.
pandeiro: how did you workaround it?