This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-06
Channels
- # admin-announcements (266)
- # alda (20)
- # announcements (1)
- # aws (16)
- # beginners (16)
- # boot (288)
- # brevis (7)
- # cljs-dev (40)
- # cljsjs (32)
- # cljsrn (5)
- # clojars (23)
- # clojure (169)
- # clojure-art (2)
- # clojure-czech (3)
- # clojure-finland (1)
- # clojure-italy (3)
- # clojure-norway (1)
- # clojure-russia (88)
- # clojure-sg (3)
- # clojurescript (300)
- # clojurewerkz (8)
- # community-development (14)
- # component (4)
- # core-matrix (1)
- # cursive (9)
- # datavis (26)
- # datomic (44)
- # devcards (3)
- # funcool (1)
- # hoplon (7)
- # jobs (4)
- # ldnclj (11)
- # lein-figwheel (1)
- # nyc (2)
- # off-topic (4)
- # om (149)
- # onyx (1)
- # overtone (1)
- # parinfer (15)
- # proton (3)
- # re-frame (9)
- # reagent (45)
- # yada (2)
@crocket: I think externs are only needed for :advanced
optimization so the compiler knows what not to rename. It shouldn’t be necessary for :simple
.
Hello everybody, I'm new to clojure / clojurescript. I was wondering how to make a Om app "universal/isomorphic" ? Is there a way to achieve this?
As Om is just a Clojurescript interface to React, and React is isomorphic, it is possible
@esnunes: Welcome. There is an #C06DT2YSY channel where you might get a quicker response.
Assume that fs.readFileSync
returns a buffer object which has variables and functions. How could externs protect those in a buffer object?
The buffer object can be named in any way. It seems I should use JSDoc to annotate that it returns js/Buffer.
Hi. Has anyone successfully used Adzerk's cljs-repl task with boot version > 2.5? I'm trying but keep getting missing file errors and was wondering whether it is just me.
@mjmeintjes: I haven't upgraded in a while so can't help. You might get a quicker reply on the #C053K90BR channel.
Thanks @meow
If I want to parse and fetch a particular query param, is this the right goog lib to use?
https://closure-library.googlecode.com/git-history/docs/class_goog_Uri_QueryData.html
I’m trying it but it’s giving me weird results.
I guess it works.
For the uri "
it has these keys/values
temp1.getKeys()
[""]
temp1.getValues()
["ferret”]
I didn’t think the root URI would be part of the key.
Oh I see, should have been using this class instead. https://closure-library.googlecode.com/git-history/docs/class_goog_Uri.html
Sometimes it's one of my source files and sometimes its a dependency that I've included
Sometimes, if I deliberately break the namespace in the file referenced by the error it will switch to referencing another file
Caused by: java.io.FileNotFoundException: resources/public/js/compiled/app.js (No such file or directory)
. Does that file exist?
sure. so looking at your stack trace it looks like one of your components is failing to start, most likely because of the absence of that file (which is silly, as it doesn’t exist yet). Is there anything in your project which is configured to look for that file, and might be trying to read it even before it exists?
better yet, if your source code is public could you post a link?
Are you sure all your parens are in order? That sounds like something that happens when they aren't.
@jaen the analysis error doesn't even seem to be specific to a single file, sometimes it throws on my source, sometimes on secretary, sometimes on reagent
yeah, I’ve cloned down your repo and I get the same error, so it’s not just your environment/machine
did this work before? if so then what’s the most recent thing you changed?
Yeah, I can point you to a working commit, but we're doing this for a game jam, so commits haven't been particularly granular
Ah, I see.
Yeah, clojure errors are pretty brutal, one of the worst aspects of the language.
Yeah, I love the language, but the errors are enough to make me consider leaving it alone for a few years whilst the tooling settles down and stabilizes
Well, the tooling is already considerably better than it used to be. Errors like those are more on the account of the dynamic nature of the language, regularity of syntax and implementation, so I'm not sure waiting a couple of yeras will fix all of that. Like I said I've usually gotten similar errors where I misplaced some parens. Let's see if I can run it over here.
Off the bat I've gotten not imported css
in styles.core
and when I fixed that I've got a compile-time stacktrace. Huh.
With regards to the tooling, I'm not saying that it's bad. It's gotten a lot better since I first tried Clojure (2012)
But this kinda of error is debilitating. I can't understand it, I can't reliably reproduce it
It doesn't always throw for the same file, it doesn't give me a line/col to reference
For example you go game.ui.widgets
-> game.state
-> game.views.heroes
-> game.ui.widgets
Then it might not be this one, it was an example. Maybe when you added a file the order you walk dependencies in changed and you hit a cycle? Or you know, it's a dynamic language - it sorta worked until you hit a corner case.
Sometimes things will apear to work in Clojurescript even if that's unintended (like aget
for objects). Host language sticking through and other caveats.
Like I said I thought Clojurescript can notice those cycles (I remember circular dependencies being pointed out to me by the compiler, thought I don't remember if that was Clojure or Clojurescript). In general - you shouldn't be getting stack overflows during the analysis phase, it's quite possible you hit some corner case compiler can't deal with.
Ok, well I'll follow through and resolve all the circular deps and then carry on tentatively
When I started getting the error, it would happen when and only when I killed and restarted figwheel
Which meant that I'd develop for half an hour or more, then restart figwheel only to find that something in the last session had brought back the analysis error
Well, I don't know about figwheel exactly, but back when I used leiningen I remember compilation errors that only went away after a clean rebuild (or happened only after a clean rebuild).
Boot is better in that it always does a clean build and relies on the compiler to do the caching instead, so such errors should be rarer.
Assuming the incremental compilation is built into the compiler, then isn't the compiler already handling the important caching, regardless of Lein?
Hah, I must say I don't really know specifics of how either handles the compiler. I am aware of Clojurescript's compiler API that gives you watch feature which recompiles only changed files, but that's probably not what either uses and they probably opt to handle the analysis environment by themselves.
What I meant there for boot is that doesn't re-use compilation results in the way lein does across runs (so no need for clean
), which might result in weird errors. Inside a single run they should probably behave similarly, but then again - I don't know the implementation details to say it with certainty.
I think I ran into a bug with om.next, not sure if it's a actual bug or I'm messing up something: Basically when running set-query! or update-query! on a (grand)child component the params of that query get updated, but it doesn't a change anything the root query --> "No queries exist for component path (om-tutorial.core/RootView om-tutorial.core/ThResultTableView)", :data {:type :om.next/no-queries}}
Did I overlook something obvious or should I file an issue?
@iwankaramazow: your query does not compose to the root
ok, thanks! I'll move it to #C0DT1AZD3 (not sure why my query doesn't compose to the root..)
@danthedev: Speaking of tooling, Cursive with structural editing mode will save you a lot of grief from simple things like misplaced parens. I can't imagine writing Clojure code without Cursive (or Emacs/Spacemacs, not to start an editor war, just pointing out good tooling).
@jaen: @danthedev : Neither boot-cljs or cljsbuild uses watch
from Cljs Build API but just call build
repeatedly with the same compiler-env
, this way Cljs compiler will take care of analysis cache between recompilations. Logic to check which files and namespaces need to be (re)compiled is built into Cljs compiler.
@danthedev: circular dependencies are detected, but it maybe you have found an edge case of some kind that would need a minimal repro against master. Another person has reported this as well - but as of yet no one has taken the time to create a minimal reproducer.
errors are high priority and always have been - but better errors come as direct result of an active community interested in helping core developers work on it
@juhoteperi: yeah, thought so, but wasn't sure. Thanks for clarifying.
@danthedev: also I’ve seen Figwheel swallow analysis exceptions
so if it’s not a ClojureScript bug, the same rules apply - the only way for Figwheel to give better errors ...
@meow: @dnolen Mostly the problem with the errors is just verbosity (syntactic ones I can catch in my editor)
@danthedev: gripes are fine - but people make often make statements that actually end up being about whatever various tooling they’ve thrown in with. Nothing in ClojureScript itself.
so that everyone has the knowledge to sort these things out quickly instead of guessing
@danthedev: cljsbuild also isn’t ClojureScript
4 years of development have shown the interactions are non-trivial and often in the 3rd party tooling.
So, best way to produce the reproduction is recreate it, then try to build the clojurescript without tools?
@danthedev: yes the Quick Start covers this
all tools either reuse what ClojureScript does or faithfully copies the behavior - it’s a bug not to.
probably the most important piece of advice I could give to anyone using ClojureScript would be to spend some time understanding how it works fundamentally. Tooling issues become instantly recognizable when you know the fundamentals works.
90% of frustration discussion I see are people stuck fighting whatever cool tooling they heard about and not understanding how it works because they don’t know how the underlying thing works.
which reminds me, somebody should really do a newcomer friendly FAQ on the ClojureScript wiki on the various Java-isms you should at least basically be familiar with - classpath, Maven, poms, etc.
as a newcomer, i’d love that. being a javascript developer getting into CLJS, a quick primer on Java ecosystem and common idioms would be super awesome
Well, this is funny because I don't know more about each than: "something like LD_LIBRARY_PATH
" for Java" , "some Java dependency management", "some xml file thing Maven uses" respectively and I can get by just fine.
But on the other hand there are no decent explanations about deployment, so in general I can agree there are certain topics people not familiar with Java could benefit from having explained.
@jaen I see people struggle with deployment constantly - usually due to a lack of understanding about the Java-isms and how Clojure(Script)-isms map onto them.
Also, I guess the answer is no, but need to verify - when writing a Clojurescript macro there's no reliable way to cross the phase barrier with things other than the argument macro gets, right? I wrote a macro that works great in Clojure (because I just can eval things as needed) but I need it to work in Clojurescript and I'm trying to figure out how to get it to. Hmm... I guess cljc might be useful here somehow?
@jaen I don't know a lot more than you do now, but that alone gives me an idea of what could be wrong (my dependencies? then is it caching, the network ?). Knowing that ~./m2
exists have been useful too.
@jaen if you actually need eval there’s no way to make it work (w/o bootstrap) - if you don’t, then yeah can probably be make to work
weird reflex stuff like double checking multiple things aren’t polluting the classpath etc.
Yeah, thought so. Thanks for the confirmation. I guess I just have to re-architect it somehow then. I figured that maybe if them records had the same namespaces in both Clojure and Clojurescript I just could use them from both, but this feels like a hack I'm going to regret, so I'll just probably go figure out how to structure it differently. I basically hoped I could expand my datascript queries during macroexpansion, but this requires knowledge about entities and that would then need to be shared between Clojure/Clojurescript.
Yeah, learning about deployment was vexing. I've only dealt with Ruby deployment before and figuring out all that deployment-related part of the ecosystem was tough, where everyone just assumes you understand what a servlet container is and what arcane combination of xml tags is needed to add a port listener. Ruby was considerably simpler by comparison (if somewhat annoying due to not being able to uberjar it up like on JVM).
But that's just about the only part of the ecosystem differences I've found hard so far.
@dnolen Created a build using the standalone cljs.jar and I get a slightly different stacktrace, but still the same analysis error. From here, is it best to distill the code into the bits that throw then create an issue?
@danthedev: yes can you please gist the stacktrace though? thanks
For reference (the rather large) reproduction with cljs.jar is here, too https://github.com/DanjoeGames/lispjam/tree/repro
@danthedev: hrm yuck - yeah not helpful (the stacktrace)
@danthedev: I’m assuming this is ClojureScript 1.7.170?
@danthedev: yeah no idea, we have circular dependency logic on the path shown by the stacktrace
Hm, is there any verbose switch for the compiler to say which namespaces it analyses in turn?
@dnolen: That's fine. I'm glad it wasn't just me that was stumped. I'll see what I can do with cutting that reproduction down. Might be a while though, currently backpacking in South Asia and network connection isn't always as reliable as today.
@danthedev: no rush, this one seems genuinely weird to me.
@danthedev: hrm I tried a minimal circular dependency thing and it seems to not be working - so will look into that first
Yeah, I've just checked it with :verbose true
and it results in this:
Compiling /home/jaen/projects/lispjam/src/game/ui/item.cljs
Compiling src/game/util/core.cljs
Compiling src/game/models/items.cljs
Compiling /home/jaen/projects/lispjam/src/game/models/hero.cljs
Compiling /home/jaen/projects/lispjam/src/game/procedural/hero.cljs
Compiling src/game/ui/widgets.cljs
Analyzing file:/home/jaen/projects/lispjam/src/game/state.cljs
Analyzing file:/home/jaen/projects/lispjam/src/game/views/heroes.cljs
and then just keeps oscillating between the last two. Seems like a fairly simple cycle.please, support cljs by vote http://www.slant.co/topics/558/compare/~elm_vs_clojurescript_vs_purescript
hello all! I'm trying to use Clojurescrip/Reagent. What is idiomatic way of state propagation? If I have atom @a and dependent atoms @b and @c. I want if @a changed then updates for @b and @c applied automatically. thanks!
@jaen: so, I need to google "clojurescript reactions"? )
@dnolen: Thank you!
@mike1452: there's not much to it, it's basically:
( reagent.ratom/make-reaction (fn [] (something-that-depends @on @some-ratoms)))
Generally whole readme and wiki (especially reagent tutorials - https://github.com/Day8/re-frame/wiki#reagent-tutorials - they will reach you all you need to know about reagent component definition forms and such) is a really insightful read if you want to use reagent.
@jaen: Thank you! Clojure/Clojurescript world has awesome community!
Hello, I'm having trouble (shown ^ above) with specify
. The code works in the namespace something.deque
, but it doesn't work in any other namespace, as shown above.
@decoursin: you need to refer pop-front
@dnolen: Ok thank you. Why, though, would this work (-conj [3 4] 8)
? I'm guessing that -conj is global?
@decoursin: same reason first
works or anything else from cljs.core
@danthedev: circular dep issue resolved in master, thanks for the report
is lein-bower a thing that people use anymore? it looks like it hasn’t been touched for 2 years
are we really sure about that? https://github.com/clojure/clojurescript/wiki/Google-Closure-Library#import-a-class
@dnolen: it does not work for me. I’m preparing a minimal repo to reproduce. Unless I’m too tired to catch the issue….
@magomimmo: you need to be more specific
@dnolen: give me a quarter I got an error inside a complicated project and I want to be sure about the issue
@magomimmo: ok, we do have tests for the described import usage - but you might have found some other edgecase
I have a clj/cljs project. When I enable lein cljsbuild hooks it no longer runs the clj tests with lein test
. Ideas on making that work? If I use the test-refresh
plugin it works, strangely.
Ah, found this that looks helpful https://blog.8thlight.com/andrew-zures/2014/03/08/combining-clj-and-cljs-libraries.html
@dnolen: here it is: if I use (:import goog.Uri)
I get `WARNING: No such namespace: goog.Uri, could not locate goog/Uri.cljs, goog/Uri.cljc, or Closure namespace "" at line 9 src/googuri/core.cljs
WARNING: Use of undeclared Var goog.Uri/parse at line 9 src/googuri/core.cljs`. If I use (:require goog.Uri)
everything works as expected. https://github.com/magomimmo/googuri.git
@magomimmo: does (:import [goog.Uri])
work?
@magomimmo: hrm now I’m getting skeptical
@magomimmo: I’m not interested in require
@magomimmo: we have an import test for goog.math.Long
, [goog.math Vec2 Vec3]
, [goog.math Integer]
@magomimmo: I’m not suggesting you use import
@tony.kay: Here is some more information on how to enable testing with cljsbuild in case you haven’t seen it yet: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/TESTING.md
Hi all, I'm looking for a library/example that could help in building a spatial organizer/kanban -style board in clojurescript. Anything to do with drag/drop, sorting, etc. I'm having no luck with my google-fu and any help would be greatly appreciated.
@magomimmo: I just tried here, (:import goog.Uri)
works
@dnolen: I don’t know what to say. Have you tried the minimal repo? Perhaps I’m too tired (here it’s night)
@magomimmo: I don’t look at 3rd party setups
@magomimmo: thx, night!
@tony.kay: might be a difference in what leiningen profiles are being activated when running lein test
vs lein test-refresh
.
@jakemcc: Thanks. Yeah, it looks like a config bit that got missed in general. Not a cljsbuild issue I don't think.
@loganmac: you have a lot of options - it really boils down to whether you want to use ClojureScript w/ some JS framework or if you want to do it from scratch using only Google Closure Library DOM / event helpers
I'm flexible - I'm a JS dev trying to cut my teeth on clojurescript and a friend asked me to build her a kanban board as an intro project
@loganmac: React dominates ClojureScript since it’s immutable friendly. Lots of people like Reagent - it presents a small number of novel concepts if you’re used to JS dev.
if there’s no interesting network component that’s probably the route with the fewest hurdles if you’re new to Clojure(Script)
@dnolen thanks! Yeah it should be pretty simple. I'm just looking to demo the drag and drop organization functionality then I'll add state/saving to an API etc later
@loganmac: https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/droppable
@loganmac: there’s an active #C0620C0C8 channel if you have questions about the cookbook etc.
reagent is indeed easy to get into, i never touched react in javascript and so far it's been very comprehensive
is there a best-practice way of including 3rd party react components? do people use / autogenerate externs?
@yaniv I’m not aware of a really good auto-generate externs thing (could be wrong about that)
people usually use webpack or some other thing to build the JS stuff into a single foreign dep
i was thinking maybe there’d be a way with react-doc-gen since it can parse into a json structure that understands components / props
there’s the possibility of interacting directly with npm stuff - but it requires a bit more support from Closure Compiler
k that’s what i’m doing. if i create a single webpack bundle I can use :module commonjs?
@dnolen: I can’t sleep . I tried without any buld tool as documented in the Quickstart wiki. Same warning with import. Here is the minimal code.
(ns helloguri.core
(:import [goog.Uri]))
(enable-console-print!)
(defn foo
"I don't do a whole lot."
[s]
(let [uri (goog.Uri/parse s)]
(.getScheme uri)))
(println (foo "”))
@magomimmo: trying that
@magomimmo: ha this is a miscommunication
@magomimmo: https://github.com/clojure/clojurescript/wiki/Google-Closure-Library#import-a-class
@magomimmo: thx for making the minimal case!
so i’m trying to figure out why i can’t import my 3rd party components. in my boot config compiler-options I have:
{:foreign-libs [{:file “resources/js/components.js”
:provides [“components”]}
and in my cljs i have
(:require [components :as c])
does that look right?@yaniv: require does not look right. should just be (:require [components])
not sure about webpack, but seems like a umd build w/ output.library set should work
also i wanted to be able to refer to my components as c. so i can use c/view for example
also how do people deal with the mismatch in conventions? react world is PascalCase while cljs is kebab-case
Well, with :foreign-libs
you have to leak a global you then pick up with js/Something
as far as I know.
^what jaen said
okay so i guess i have to switch to UMD then. i thought :module-type commonjs provided the other option
although, after the GSoC work, that may not necessarily be the case in certain circumstances, looking at this: http://mneise.github.io/posts/2015-08-04-week-9-and-10.html
from that post:
(ns circle-color.core
(:require [clojure.browser.repl :as repl]
[React :refer [createElement createClass render]]
[Circle :as Circle]))
yeah, very few people have tried afaict, so not sure if it actually works or not
But in that case you need the :module-type
option to let the compiler know it needs to translate it to a GClosure module.
there's also this project, linked from the above blog post: https://github.com/mneise/circle-color
my js lib is transpiled to ES5 with commonjs output but has been processed with babel… so i guess it should be equivalent minus the jsx transform
Well, the sources are preprocessed in some way though - raw React is separate files after all.
i’m gonna have to dig through this for a while. it’s gonna be hard to do what i want. this gets you half of the way there cus essentially you need to do a single build for the whole project. and for that to work for me it’d need to be a webpack build with my webpack config