This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-09
Channels
- # beginners (140)
- # boot (163)
- # cider (43)
- # cljs-dev (50)
- # cljsjs (5)
- # cljsrn (38)
- # clojure (152)
- # clojure-austria (10)
- # clojure-berlin (9)
- # clojure-dev (11)
- # clojure-japan (1)
- # clojure-miami (2)
- # clojure-russia (147)
- # clojure-sg (12)
- # clojurescript (244)
- # code-reviews (3)
- # cursive (104)
- # data-science (5)
- # datavis (15)
- # datomic (35)
- # editors (4)
- # hoplon (1)
- # ldnclj (11)
- # lein-figwheel (14)
- # leiningen (22)
- # off-topic (53)
- # om (373)
- # omnext (2)
- # onyx (67)
- # parinfer (193)
- # re-frame (23)
- # reagent (89)
- # yada (7)
@dnolen: The possibility of using Closure as a bundler for React Native is mentioned in Markbåge commit :) crossing fingers https://twitter.com/sebmarkbage/status/674392365260341248
Is there a way to “require” local edn
data file? In node/js, I’d require()
a .json
file. I’ve got some largish data, and I could put it in just a normal .cljs file, but I was wondering if there’s a way to get it from a separate file (so it doesn’t clutter up the code)
If you just want it in an edn file for organizational purposes you could use a macro to read the file at compile time and basically in-line it into your cljs file
hi clojurescript folk! i ran into an issue with om next, datascript, and react native in how it handled rerenders from the root. might be a larger cljs/react native integration to be aware of. heres a gist of a reproduction and the reconciler implementation i made that (seems) to address it
also have some gifs of the bug in comments in the gist
HACKON
@johannjohann: you’ll want to ask your question in the #C06DT2YSY and #C0E1SN0NM channels
Hi people!
We’re running into a silly issue: how do we detect if js/window exists without running into reference erros?
errors
for instance, on node runtime
@joost-diepenmaat: exists?
so (exists? js/window) ?
ok thanks that looks like what we need
thanks!
if advanced optimization + externs isn’t working the answer is nearly always, "the externs file is not complete"
@dnolen: The compiler does not take line:204 (@return {{line:number, ch:number}}) into account?
getCursor
should probably be given a a type (even if fabricated) and that type should appear in the externs file with its properties
@dnolen (aget cm "line") is the workaround I came up with, but I really wanted to figure out whats going wrong. Thanks!
really they are no different from TypeScript typing files and they give you more control over the final artifact
Annotating JavaScript for the Closure Compiler https://developers.google.com/closure/compiler/docs/js-for-compiler?hl=en
@dnolen Actually been there before. Did mistakenly expect that property names are taken into account for @return
.
just wondering if you ever posted cljs on the nytimes properties, and I was looking for a cool example
ramda is great fun , but doesn't handle nils like I'd expect because it's written by a bunch of haskellers.
@ghadi I did use Clojure for some offline things, but nobody cares about that stuff. We even used Haskell for offline stuff.
we're thinking about moving our JS code over to Mori from immutable.js b/c wedging in Om.Next looks realistic. thanks @dnolen
seems a better target than relay or falcor, because we (I) don't care about node.js at all, and I do care about clojure.
As far as I can tell, that's the canonical way to add those deps, but neither of them were automatically installed.
:dependencies [[org.clojure/clojure "1.7.0"] [org.clojure/clojurescript "1.7.170"] [org.clojure/core.async "0.2.374"] [reagent "0.5.0"]]
If you also write Clojure, do you tend to restrict your Clojure ns
forms to the constraints of ClojureScript (avoiding prefix lists, etc.)? Just curious if that’s common practice.
@mfikes: No every few months I forget CLJS doesn't support the prefix list syntax actually and stare at the error output for a while before remembering...
When dealing with long namespaces (> 5 segments), like in com.acme.project.subproject.app.frontend.views.*
I really miss that actually
but I have seen that they are quite popular, still nothing will convince me of adding any of that stuff to ClojureScript
Anyone have any experience running figwheel inside of Docker? I've been trying to figure it out for a bit, and I'm not having a ton of luck.
sdroadie: I run the CLJS stack inside of Docker, not specifically figwheel, but I can probably help
@pandeiro: Sweet. We're deploying our app with Docker, and I'm just trying to get our dev environment as close as possible to production.
@pandeiro: For production, we're shipping an uberjar, but for dev, we're using Figwheel because hot swapping is pretty rad.
@pandeiro: Though honestly, I feel like Docker might be more my point of difficulty as I'm thinking about. Ideally, I could statically assign an IP to my container, set that to the :websocket-port for Figwheel, and be on my way.
@sdroadie: You have two options basically -- exposing ports between the container and the host, or changing the --net
parameter to 'host' to simply run the container on the host's network stack
The former is more 'correct' and 'the Docker way', but can be impossible if containers have bi-directional links
For production, we have a .jar running in one container, and postgres in another. Simple, easy to set up, no issues.
The only thing I'm not sure about is if you're using OS X, b/c then you're actually using Docker and VirtualBox, and there are issues with the latter regarding volume mounting that my team and I have never been able to sort out properly 😕
Virtualbox is teh suck. I've always been having some problems with it. I also have a Clojure setup working inside docker. I on the other hand bind exposed ports to host ports and it's working well.
@jaen: yeah binding works fine; what doesn't work is mounting volumes from hosts in OS X to Docker through VirtualBox, especially when there are symlinks anywhere in them
@sdroadie: did you created a shared/shareable Dockerfile for CLJS by any chance?
@richiardiandrea: I haven't, sorry. I only have the Dockerfile for prod, which just grabs a jar file, exposes a port, etc.
@pandeiro: yeah; I tried to get my setup running on a Windows machine (main reason I did a docker setup, so that Windows people in the university project could have an easier time working on that) and it failed miserably '
@pandeiro: cool stuff
@jaen: had the same experience too, visions of "run everywhere" including our product people's Windows machines... sadly, no 😞
@jaen: Not sure if you've tried recently, but I've found it pretty easy developing cljs on Windows now - way, way easier than a year ago.
Might be feasible to get rid of docker if it was just for ease of setup
Possibly, though I hoped I wouldn't have to hand hold people through that, just tell them to install docker and call it a day.
Did the parallel build stuff that was happening ~1/2 months ago end up making it into ClojureScript?
think it is experimental but in yes
http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojurescript%22
@richiardiandrea: it will appear in the next release
ooooops sorry @dnolen I assumed it wrong
@richiardiandrea: quite a few people have tried it out now and as far as I know I’ve fixed the obvious problems in the initial cut of it (clobbering System.out)
@dnolen: we had a crash in an internal project
we haven’t had time to make a minimal case yet
@danielcompton: for :parallel-build
that’ll probably require more effort on your side to report since minimal cases will be quite tricky
I do suspect for anything that calls into macros with side-effects you’re going to have a hard time getting it to work reliably
and ClojureScript libraries that lie about dependencies between namespaces will spew warnings (devcards appears to have this problem)
@dnolen: What would be an example of a macro with side-effects here? Would reading from the filesystem to inject static values into build count as side-effects?
@pandeiro: generally a ns is compiled once it dependencies are compiled, if they depend on the macro that was not required before they enter a race
So then that means code that e.g. uses core.async would potentially face this race condition using :parallel-builds
?
For completeness, here’s the stack trace we get
@danielcompton: right so this is probably the issue @theller has already pointed out
@thheller: in that ticket you say "FWIW the gain was minimal to begin with." <- you're referring to the gain in compile time with parallel building right?
I managed a 6.5× speedup on an artificial project: https://github.com/mfikes/fifth-postulate
@pandeiro: with cljsbuild we got parallel false: wallclock time: 95 seconds, build time 84 seconds parallel true: wallclock time: 62 seconds, build time 50 seconds (and a bunch of warnings which don’t show up with parallel false)
@danielcompton: @thheller: I just added locking around clojure.core/require
usage might want to try with master
@danielcompton: looks pretty good
as I said the warnings mean you have some assumption about load order that do not respect the actual declared dependencies
I haven’t seen this problem in any cognitect ClojureScript libraries (core.async) or my own stuff
@danielcompton: there may be a bug here but I have yet to see any evidence of it yet
And timbre was the culprit for breaking our parallel builds, pulling it out let us build fine
Yeah, the master
seems to fix require issues. I've tried :parallel-build true
in one project and got a bunch of warnings like
WARNING: Use of undeclared Var cljs.core.async.impl.channels/ManyToManyChannel at line 30 .../public/assets/javascripts/application.out/cljs/core/async/impl/channels.cljs
With freshly build compiler it's gone.with boot i'm not seeing any appreciable difference, neither with :none
nor :advanced
@pandeiro: not necessarily, a lot factors could mean you don’t see any change or that it’s small
@pandeiro my project has very little gains too, it really depends on how your project is structured
Compile sources, elapsed time: 18861.283601 msecs ; not parallel
Compile sources, elapsed time: 8902.465968 msecs ; parallel
This project here - https://gitlab.com/jaen/clj-cljs-presentation
basically I have a bunch of "small" namespaces that can be compiled in parallel but all compile in <50ms
WARNING: Use of undeclared Var cljs.core.async.impl.timers/skip-list-node at line 34 .../public/assets/javascripts/application.out/cljs/core/async/impl/timers.cljs
@dnolen: running from master, now I can build the project (with timbre in it) sometimes, and other times it fails with different errors. And the warnings we’re getting are different every time
@danielcompton: again there is a limit to what we can accomplish given arbitrary side effects, programmatic require, and all the other crazy things Clojure lets you do
so we can put a lock around require
in ClojureScript but that won’t fix everything since require
isn’t thread-safe
Hi, I just got this error compiling my clojurescript using figwheel: {:tag :cljs/analysis-error} ANALYSIS ERROR: on file null, line null, column null
The problem was a circular ns reference I introduced accidentally. Would it be possible to show that in the error message?
@sveri Figwheel obfuscates the message more than it should. ClojureScript fixed the deeper in master a couple of days ago
Is it possible to :refer-macros
and rename them to something else? Or access them by their alias?
:include-macros
is what I was looking for
@danielcompton: :include-macros
doesn’t do that, it just allows you do avoid the corresponding :require-macros
there is as of yet, no :rename
support in ClojureScript, and I said earlier I would be OK with a patch for that
doesn’t :include-macros
let me access them by alias though?
(ns my.ns
[cljs.test :as cljs-test :include-macros true]
[jx.reporter.karma :as karma :include-macros true]
…
(karma/run-tests
(cljs-test/run-tests
because cljs.test
runtime & macros have same namespace and cljs.test
runtime requires the macros ns
the only thing that doesn’t work yet is macro var inference in :refer
, patch welcome for that too.
cool, thanks for explaining (what must be your millionth cljs macro explanation)