Fork me on GitHub
#clojurescript
<
2015-06-08
>
mfikes00:06:23

@quentin: This is because your project.clj specifies a version of ClojureScript that requires Clojure 1.7.0-x, but with Clojure 1.6.0 specified.

mfikes00:06:56

@quentin: One useful tool for diagnosing mismatched dependencies is lein deps :tree. In this case it would emit

Possibly confusing dependencies found:
[org.clojure/clojure "1.6.0”]
 overrides
[org.clojure/clojurescript "0.0-3308"] -> [org.clojure/clojure "1.7.0-RC1”]

bhagany04:06:36

I've been running figwheel in a terminal, but I've finally decided to give inf-clojure in emacs a try. It seems to be working okay, but I oddly never get another repl prompt after the first one. I can evaluate things in the \inf-clojure\ buffer directly, or from other buffers, and results show up, but no prompt. Has anyone seen this?

bhagany04:06:06

I should mention that a normal lein repl via run-clojure doesn't have this problem

bhagany04:06:27

heck if I can figure out how to escape those asterisks correctly

bhagany04:06:58

huh, figured it out, kind of, but it's odd. In my dependencies, I was grabbing the aot'd versions data.json and tools.reader, and then excluding them from the deps that clojurescript itself pulls in, like so:

[org.clojure/clojurescript "0.0-3308" :classifier "aot"
    :exclusions [org.clojure/tools.reader org.clojure/data.json]]
[org.clojure/data.json "0.2.6" :classifier "aot"]
[org.clojure/tools.reader "0.9.2" :classifier "aot"]
Removing data.json and tools.reader, as well as the :exclusions makes the prompt bug go away

sander06:06:02

anyone familiar with http://thi.ng? when including http://thi.ng/color in my cljs project, i seem to only get access to a small subset of the core functions

sander06:06:14

seems like for example core/rgba->css is compiled into core.js, but it doesn't become part of thi.ng.color.core in the js console

sander06:06:56

fixed by requiring thi.ng.strf.core before requiring thi.ng.color.core

quentin07:06:43

@mfikes thanks a lot ! lein deps :tree looks very helpful too simple_smile

quentin09:06:57

interesting talk, but it won’t help you to use it ^^

sander10:06:34

@thomas: nice, thanks for the link!

ricardo11:06:49

Any pointers to cljs.test documentation? I keep running into the announcement (https://groups.google.com/forum/#!topic/clojure/gnCl0CySSk8) but not much else.

martinklepsch11:06:20

@ricardo: should be just like clojure.test — the stuff you’ll need to take care of is running it and there are a few approaches out there I think

ricardo11:06:43

@martinklepsch: That's what I've read, but even a trivial test is (apparently) stuck. Not sure if it's some set up issue I'm missing.

ricardo11:06:36

For instance, my ClojureScript code references a .js library. I'm not sure how to specify these imports, so I'm getting a ReferenceError. Unclear on if that's what's causing the test not being run, though.

bcachet12:06:57

@ricardo: if you depend on external JS lib, you should add :foreign-libs [{:file "path/to/lib.js" :provides ["lib-namespace"]}] to cljsbuild configuration Then you can require lib-namespace in your CLJS

bcachet12:06:19

or maybe your JS library is already packaged via CLJSJS: http://cljsjs.github.io/

bcachet13:06:12

@ricardo I'm fairly new to CLJS, take these advices accordingly

dnolen13:06:00

@ricardo we try to keep the wiki up-to-date with information about stuff like this - https://github.com/clojure/clojurescript/wiki/Testing

dnolen13:06:30

@ricardo if there’s anything missing there let me know

ricardo13:06:12

Thanks @dnolen, not sure why that one hadn't come up. You may want to change the URL for the readme here https://github.com/Prismatic/cljs-test so that it points to the wiki page.

ricardo13:06:28

Currently it points to the announcement, which is what I kept finding on my searches.

dnolen13:06:47

@ricardo I don’t have anything to do with Prismatic

dnolen13:06:58

I would just use the wiki

dnolen13:06:05

lots of stale links through Google

ricardo13:06:23

Oh, my bad. Been looking at so much stuff that I'm sort of code blind right now. Going to file an issue for them.

ricardo13:06:31

Didn't even notice the repo owner.

ricardo13:06:06

That's the signal for me to take a break. Will be back soon to review it, thanks.

ricardo13:06:57

@bcachet: Thanks for the pointer, will review if it applies.

ricardo14:06:56

This has been bugging me... https://github.com/emezeske/lein-cljsbuild/blob/master/sample.project.clj#L62-L66 The cljsbuild sample project states that :builds should be a sequence of maps, but on the examples is set to a map of configurations with what looks to be like the configuration as the key.

ricardo14:06:55

Both seem to work, but is there a preferred approach? Will the other be deprecated?

bhagany14:06:46

I have wondered this as well

bcachet14:06:49

reading lein-cljsbuild code, seems that both are valid. map of configurations are converted to sequence of maps: https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild/config.clj#L39-L44

bhagany14:06:17

sure, both work. I think we're more wondering which is preferred, if any.

ricardo15:06:56

Hmm, in fact I think I just stumbled into a case where the map works better @bhagany @bcachet

ricardo15:06:55

Profiles on lein are merged. If you declare your :builds as a list of maps, instead of a map, then when you try to alter just one value on a profile you end up with one more build configuration

ricardo15:06:08

Instead of replacing the value you thought you were going to replace.

bhagany15:06:49

alright, that's interesting

ricardo15:06:06

Yeah, it just bit me. I was wondering why it was trying to build a cljsbuild-main.js that failed as if some foreign-libs weren't specified (and as a third configuration)

bcachet15:06:18

Thanks @ricardo I will be more careful when creating builds. I have to say that I move to boot build tool because I find it easier to setup when configuring complex tasks (reload page when JS/CSS are modified)

ricardo15:06:36

Anyone had an issue where you run lein cljsbuild test using phantomjs, the tests run and the report is printed, but the process doesn't seem to exit?

bcachet15:06:59

But still need Leiningen project file when using CursiveClojure

dnolen15:06:43

@ricardo: that’ll probably happen if you’ve installed something into the browser event loop somehow (setInterval, setTimeout etc.)

ricardo15:06:06

Thanks @dnolen, will review although I don't believe I have. It's a trivial runner.

dnolen15:06:47

@ricardo: phantomjs may also require explicit exit? never used it myself.

ricardo15:06:11

Let's find out.

ricardo15:06:22

Nope, gave it a couple of minutes and had to kill it. Will review.

luke16:06:57

phantomjs does require explicit exit

nvbn17:06:18

@ricardo I wrote a little article about cljs.test, I guess it can be useful for you - https://nvbn.github.io/2015/06/08/cljs-test/ 😃

andrewmcveigh17:06:40

Macro to selectively compile based upon cljs build number

bcachet17:06:49

@nvbn: thanks for your article. Very nicely written.

dnolen17:06:01

@andrewmcveigh: nothing comes to mind

zane17:06:23

Hmm. In Om, what are the conditions under which I might be able to change the application state without triggering a re-render

andrewmcveigh17:06:39

@dnolen: OK, thanks. Is that kind of thing “acceptable”? I’m not too fond of it, but couldn’t think of any other way.

dnolen17:06:12

@zane: see commit!, it’s worth skimming the source from bottom to top at least once to see what is there.

dnolen17:06:28

@andrewmcveigh: you need to detect the version, not sure what else you can really do.

andrewmcveigh17:06:44

@dnolen: fair enough, thanks.

zane17:06:00

@dnolen: Oh. I'm actually trying to schedule a re-render, but am failing. I see my application state changing, and I see render being called in the relevant components, but the DOM isn't being updated somehow.

zane17:06:16

I've probably done something stupid here, but I can't figure out what.

dnolen17:06:46

@zane there was a bug with 0.8.8 around this, not sure if that’s what you’re hitting.

zane17:06:53

I am on 0.8.8.

dnolen17:06:59

doesn’t mean that’s the problem simple_smile

dnolen17:06:07

no idea, but it might be.

dnolen17:06:25

you could try to install master and see if the issue persists.

zane18:06:05

Was it present in 0.8.7?

zane18:06:52

Actually, never mind. I'll just try the snapshot.

zane18:06:12

Ah, there is no snapshot.

dnolen18:06:49

lein install

zane18:06:56

Issue persists. I must be doing something strange.

jprudent18:06:11

Hi all! Is there a reason why in cljs when I use comp to compose functions the number of args is not checked when I call the composed function ?

dnolen18:06:42

@jprudent: the number of arguments is never checked at runtime

dnolen18:06:57

and we don’t do anything for higher order usage, would require a much, much more sophisticated analysis

nvbn18:06:10

@mfikes @bcachet I guess something like that should be formalized in some library, or added to cljs wiki

zane18:06:40

There shouldn't be any problem with putting a communication channel in Om's shared state, right?

robert-stuttaford18:06:25

none at all. we do this all the time!

robert-stuttaford18:06:09

just be aware that shared state can’t be altered once it’s set - you have to put the chan (and any other ‘global’ service items) in at om/root

zane18:06:43

@robert-stuttaford: Yeah, no problems there.

zane18:06:19

Somehow I've gotten myself into a state where some updates to the app state trigger a re-render and some don't.

zane18:06:50

om-update!ing a reference cursor should trigger a re-render, right?

robert-stuttaford18:06:17

you need to om/observe in the render method of the components you want to re-render

zane18:06:10

Was missing for one of the components. Thanks.

zane18:06:48

The one remaining issue I have is that reordering data within a vector doesn't trigger a re-render. Is that to be expected?

robert-stuttaford18:06:19

how are you doing the reordering?

zane18:06:37

@robert-stuttaford: Swapping two values via assoc.

robert-stuttaford18:06:03

mind sharing a snippet?

zane18:06:07

Not at all.

zane18:06:18

I'll do that in a PM.

robert-stuttaford18:06:19

i know Om fully supports vectors as cursors through IndexedCursor

zane18:06:07

For anyone following along: I needed to provide a :key because I was doing reordering.

ricardo19:06:44

Thanks for the link @nvbn

ricardo19:06:47

@nvbn: I haven't looked into phantom in detail, but I think with version 2 you can't do phantom.args[0]any more and will need to yse system.args. Found that while following up on this: https://gitlab.com/keeds/cljsinit/issues/1

nvbn19:06:09

@ricardo I use 1.9.0, which available from ubuntu repo

ricardo19:06:05

Acknowledged, that confirms it's a difference between the versions then.

nvbn19:06:19

@ricardo I'll try 2+, but probably replacing phantom.args with system.args will be enough

nvbn19:06:21

@ricardo thanks for noticing 😃

nvbn19:06:54

@ricardo also, have you tried phantomjs 2+, is react works out of the box (without es5-shim)?

ricardo19:06:35

I've just got the basic tests working at the end of the day today. Haven't gotten far enough to test that.

ul19:06:09

@dnolen: why does Om pass current state to will-update instead of the next state? https://github.com/omcljs/om/blob/master/src/om/core.cljs#L363

dnolen19:06:30

@ul that’s not what happening, -get-state returns the next state, you need to read through all the state implementation if you want to understand how it works

ul19:06:14

thanks, I will do

ul19:06:14

@dnolen: sorry for dumb questions, but get-state calls -get-state, thus I have no chance to get prev state in non-hacky way inside will-update?

dnolen20:06:26

@ul I do not write documentation for my own enjoyment simple_smile please look at this https://github.com/omcljs/om/wiki/Documentation#get-render-state

ul20:06:48

thanks, now everything in that's own places

jstaffans20:06:09

I'm writing a small browser-based game with ClojureScript, which I am not too familiar with. I'm wondering if it would make sense to write the logic parts as cljx files? Is there a point to that?

jstaffans20:06:50

I could imagine it would be easier to use e.g. test.check if it's cljx and not all straight cljs

dnolen20:06:40

@jstaffans: cljx is effectively superceded by .cljc

jstaffans20:06:57

thanks for the pointer, have to take a look at that

zane22:06:14

I'm having a bit of confusion about when to use om/build on a "component", and when it's okay to simply use normal Clojure functions and calls to om.dom.

zane22:06:14

That is to say, if two parts of the render tree differ by values that will be fixed over the lifetime of the application must I always store those differences in component-local state, or is it acceptable to use a function that takes data, owner, and the additional state as arguments instead?

zane22:06:17

I hope I'm making sense here.

maria23:06:53

Just uploaded the blog post for GSoC week 2 😉

pixel23:06:39

I may have shared something similar in the past...

dspiteself23:06:15

Looks good @maria thanks for sharing the status update.

dspiteself23:06:47

@maria: will there be a different path/configuration for the commonjs modules that after conversion can vs cannot advanced compile.