This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-14
Channels
- # admin-announcements (1)
- # beginners (7)
- # boot (30)
- # clara (1)
- # cljs-dev (3)
- # clojure (57)
- # clojure-austin (2)
- # clojure-conj (3)
- # clojure-dev (11)
- # clojure-russia (84)
- # clojurescript (105)
- # data-science (1)
- # devcards (1)
- # editors (4)
- # editors-rus (2)
- # hoplon (119)
- # immutant (1)
- # lein-figwheel (5)
- # off-topic (4)
- # om (6)
- # re-frame (75)
- # reagent (5)
Can someone suggest a good media query tool in either ClojureScript or Javascript (Cljsjs) ?
found [cljsjs/enquire "2.1.2-0"]
is there a better way of seperating out cljs deps when the clj server is in the same project (ref: https://github.com/nowprovision/webhookproxyweb/blob/master/project.clj) ?
@nowprovision: there no special syntax for that. Assuming you don't compile cljs in the server process I'd recommend using ’:scope "test"` so the cljs dependencies are not loaded for clj server
Hm, I create a future with an API call in ring handler and then deref it once in the index view. Yet when I put printlns in it, they are output twice. Is that expected? I thought futures cache their evaluation?
@dnolen Well, I'm trying to evaluate a function, which references a var from another namespace, but it complains that it cannot find it.
@dnolen this is something specific to eval right? I don't think I messed up my imports, it works in clojure (most of the code resides in .cljc files)
@moxaj: it works in Clojure because Clojure is on the JVM and has cross platform IO facilities
@dnolen Now this is strange. First a little more context: I'm evaluating code in the browser, not on node (maybe it makes no difference). When evaluating, the console tells me "warning: no such namespace ..." and "warning: use of undeclared Var ...", but it still works! I have no idea what's happening 😀
Hm, possibly you're still not resolving requires properly so the compiler can't tell whatever you're doing makes sense, but you use it properly so the generated code works? Something akin to how you can link C libraries without headers and it still works.
@moxaj: sounds like the source is compiled but you don't have any analysis information in your compilation environment.
@bhauman @jaen is this something I should be concerned about (performance-wise or otherwise)?
@moxaj: You need to make sure require
works or you will be missing some major functionality.
I don't think performance would be majorly affected, but as bhauman said compiler may not require some code you need and it will not work (though it just might as it did in this case)
Also you might not be warned about misusing your code, since there's nothing to check during compilation
@bhauman as far as I can tell, my require-s work, the problem is that the evaluated function references namespace-qualified symbols from other namespaces, the ones the compiler complains about.
@bhauman: Is there any way to let a devcard component use A tags with #? They cause devcards to navigate back to the "main menu"
@tony.kay: yeah having components that mess with push-state is not supported, it's a global concern
nope, but it seems an interesting way to solve this would be to have a component that you can wrap your components in that virtualizes routing calls
Good enough. Just wanted to make sure I wasn't missing an option. If I develop something to handle it I'll send it your way. Not critical at the moment.
@moxaj: 'Use of undeclared var...' can be ok if the var is eventually assigned before the code referencing it is actually invoked. (declare blah)
where blah is the name of the var before the reference will remedy it. Otherwise, you can move the code assigning the var to earlier in the minified JS file (via specifying compile/concat order) or moving the actual logic higher in your own files if it is a var you control.
@moxaj: In fact, in my experience I've never had that warning actually point to a real issue at run time.
@johanatan The var has its value assigned even before the (eval ...) is evaluated, and I don't think I can do it anytime earlier
@moxaj: Are you sure? Did you try printing the value of the var directly before the eval?
Are you eval'ing a string or is this a macro? If the former, I am surprised there's any warnings at all
@johanatan a string
Yea, something else is going on then. There's no way ClojureScript is looking inside your string and giving warnings about its contents
But I think it might not matter that the var is assigned before eval - I don't imagine self-hosted Clojurescript takes into account anything other than supplied sources during the analysis.
@jaen I agree. Maybe there's some way to tell the evaluator about the other namespaces - but for now I don't really care, because the code runs anyway
Hmm, yes, I used to get the warning a lot re: console.log (which is a pretty basic 'external dep' )
Well, I'm more of a correctness-first person, so I would want to figure it out first, lest it bite me in another corner case. But if it's good enough for you, then good ; d
@jaen i'll just have to set print-fn to a dev/null-like function and enable console printing later:grin:
heh, I can eval the namespace-qualified symbol and it works, seems a little hackish though
[I of course want the rest of the styles in place to remain unchanged; i.e., so a merge
rather than a swap/reset
].
for big projects I suspect the results could be pretty dramatics for cold :none
builds
I'm testing the largest project I have access to right now on my dual-core thinkpad
Will try on my 6-core i7 tomorrow
it’s pretty experimental very little in the way of error handling yet so will need to work on that.
That looks like a nice addition. Pity I don't have big enough project to compare it on ; /
@jaen even if it’s not big it will make a difference, i.e. a significant number of deps
Yea, I know the drill, you just might have happened to put out a prerelease or something
I'm seeing decrease from 35s to 25s on this dated Thinkpad
@juhoteperi: that’s pretty good!
Also, I'm seeing some warnings from random namespaces which seem be different between runs
"Use of undeclared Var"
yeah those warnings will probably depend on libs using vars not properly required or macro magic stuff
Sounds the same as what e.g. Make is doing
Hm, I'm compiling through boot. So with 170 I get 17.78 seconds and with 178 I get two values, 11.55 seconds for compilation and 14.01 seconds for adding dependencies.
@dnolen: I didn't find any problems but I have two comments:
- Instead of populating deque and input-set with doseq I think it would be possible to initialize them with inputs
(LinkedBlockingDeque has a constructor taking in a Collection)
- pollFirst
has arity with timeout which could be useful instead of Thread/sleep. I'm not sure but I presume that this wouldn't sleep for full timeout if item becomes available.
@juhoteperi: the first thing sounds great
so all threads will spin on it like crazy while waiting for an important parent ns to finish
Oh, right, the sleep is for waiting on the dependecies of the ns.
@juhoteperi: also your patch is the gift that keeps on giving