Fork me on GitHub
#clojurescript
<
2016-01-10
>
underplank00:01:13

@dnolen: if we get compile errors while using :parallel-builds who/how should we tell?

dnolen00:01:56

@underplank: you can report them here, but you need to do a lot of work on your side first

dnolen00:01:26

i.e. is the problem in your own code, in some library you are using etc.

dnolen00:01:41

once you’ve determined that’s not the case then you need to produce something minimal

underplank00:01:41

all the namespaces look to be re-frame actually

dnolen00:01:54

I don’t want to look at any projects, any libraries, or any 3rd party tooling

dnolen00:01:22

errors should be simple to reproduce outside whatever thing you are actually working on

underplank00:01:45

sure. I’ll checkout re-frame and see if thats runs on its own first.

dnolen00:01:21

@underplank: anecdotally I’ve been using :parallel-build since I landed it 2 months ago

dnolen00:01:47

I only use Clojure contribs or things I wrote myself - these libraries have never emitted spurious warnings of any kind

dnolen00:01:55

the only time I’ve seen a problem is with Figwheel

dnolen00:01:35

so I would start with the assumption that something is wrong with a library you are using until you have good evidence otherwise

underplank00:01:46

I was excited about it, so was going to give it a go simple_smile It looks like it just cant find a var somewhere that it thinks it is. i’ll dig in a bit more.

dnolen00:01:29

all this said - I’m happy to get minimal cases - I’d like :parallel-build to be reliable thing for more people

underplank00:01:44

sure I understand

dnolen00:01:47

however I’ve seen a lot of libraries that are sloppy about declaring dependencies

dnolen00:01:51

esp. wrt. to macros

dnolen00:01:52

if that’s the case there’s nothing for ClojureScript to do - people will need to make sure their libs are organized properly for parallel builds

dnolen00:01:48

@underplank: so something to look for is any implicit dependencies

dnolen00:01:17

i.e. some namespace makes an assumption that compilation would be serial and does not declare a dependency

meow00:01:02

@underplank: there is also #C073DKH9P

underplank00:01:36

@meow: yup, know about that, thanks.

dnolen00:01:43

@underplank: also the re-frame devs tried the parallel stuff when I landed it

dnolen00:01:49

and they didn’t mention anything at the time

underplank00:01:38

ahh, so although all the namespaces are re-frame it might be some weird interaction with my code. That would make more sense. I would have expected that in the first place if it wasnt for all the namespaces pointing at re-frame.

dnolen00:01:12

right as I said

dnolen00:01:15

typical problem case

dnolen00:01:37

you use a macro ns, but you don’t include the runtime stuff - because maybe expect some other ns to load it

dnolen00:01:50

but then the build goes parallel - and now you get warnings when you didn’t before

underplank00:01:50

right. thanks for the help!

mfikes02:01:07

Conjecture: If, for each of the runtime namespaces in a project, a fresh REPL can be started and that namespace successfully required, then that project can be successfully compiled with parallel builds enabled.

mfikes02:01:37

If true, this provides a linear verification mechanism.

mfikes02:01:19

You can also imagine a corollary where, if all of a project's libs are safe for parallel builds, then you'd only need to test the project's namespaces.

mfikes05:01:47

I’m interested if we can find a counterexample to the contrapositive of the conjecture above (disproving it). In other words, wondering if this always holds true: If a project cannot be successfully compiled with parallel builds enabled then there exists a namespace that cannot be required in a fresh REPL.

johanatan05:01:39

@mfikes: that wouldn't hold true unless the parallel logic is 100% bug free. Given that we haven't formally-verified the logic and have done only a finite amount of testing, I wonder how confident we can be that there are zero bugs. 😀 Some number of nines I suspect. Btw, has the parallel logic at least been property-tested? (I imagine so given David's advocacy of such).

meow05:01:57

@mfikes: look out, you're starting to sound like a mathematician all logical like and sh*t

jaen08:01:34

B... but what do you mean? That formalism isn't good D :

danbunea11:01:19

I have a figwheel configuration question

danbunea11:01:34

if I launch multiple builds: lein figwheel dev test

danbunea11:01:55

how do I configure which gets loaded into repl (Launching ClojureScript REPL for build: ...???)

cjmurphy12:01:19

What did changing the order of dev and test do?

cjmurphy12:01:11

(order they are in your project.clj file)

cjmurphy12:01:59

Or even changing the order at the command line I guess is worth a try too,

cjmurphy12:01:08

But doing dev and test independently in separate consoles, with only dev being with figwheel - another option?

cjmurphy12:01:35

By the way there are lein-figwheel and a leiningen channels, so you might have better luck in one of them. Also you might have to wait a bit - most people not around at the moment.

mfikes14:01:48

@johanatan: Right. Just wondering if the the test is inherently invalid even if parallel logic is 100% bug free.

martinklepsch16:01:21

[ANN] I finally managed to cut a release of confetti, a small toolchain to make provisioning and deployment of static sites and single page apps on AWS/S3 a breeze: https://github.com/confetti-clj/confetti — feedback welcome!

eyelidlessness17:01:57

is there a way to use .cljc files in a project that provides backwards compatibility to older versions of clojure jvm?

shanekilkelly17:01:02

pretty sure reader conditionals are only supported in 1.7 anyway

eyelidlessness17:01:06

right. which i guess means it's one or the other?

shanekilkelly17:01:13

As far as I know, you could use cljx, but it’s deprecated. I found what looks like a cool article and intro to the issue: http://danielcompton.net/2015/06/10/clojure-reader-conditionals-by-example

shanekilkelly17:01:32

Do you absolutely need to support <=1.6?

eyelidlessness17:01:08

well i don't, but i was hoping to offer a PR to another lib which currently does support back to 1.4

eyelidlessness17:01:28

i think i'm going to have to spin off a compat library instead

shanekilkelly17:01:34

ooh, yeah. that’s tricky

eyelidlessness17:01:43

the implementations are already separate cljs files because cljs collection protocols basically don't line up at all with clj interfaces/protocols

eyelidlessness17:01:58

but i was hoping to keep the tests cljc, to make maintenance easier

eyelidlessness17:01:06

got all ready to open a PR and realized it broke the old versions completely facepalm

shanekilkelly18:01:23

might be a good idea to fork the project. hanging on to 1.4 compat can be painful, and will hold the project back.

eyelidlessness18:01:00

yeah. it would also be a tough sell for me to offer a PR that says, basically, you have to lose all backcompat.

eyelidlessness18:01:26

it's one thing to lose 1.4. but if i were maintaining a project back to 1.5 or 1.6, i would probably reject a change requiring 1.7

eyelidlessness18:01:51

thanks for confirming.

meow18:01:33

one thought - older users can just pin their dependency to the version of the lib prior to your PR

solicode18:01:08

If you do that, you might get into a situation where you have to backport fixes for a while though. Which might be fine if it were your own project, but I agree with @eyelidlessness that it's a tough sell as a PR to somebody else's project.

eyelidlessness18:01:49

the project isn't super active... maintaining a fork in this case doesn't feel crazy

solicode18:01:07

Yeah, that’s an option too

meow18:01:28

they have the same tough decision to make if they want to move to reader conditionals and cljs and that work is already done by @eyelidlessness

meow18:01:09

I would offer it up and fork it if they don't want it

eyelidlessness18:01:28

yeah i guess there's no harm in offering

meow18:01:39

forward progress isn't always smooth

eyelidlessness18:01:44

backcompat is always a choice. some choose it, others choose breaking changes. both are totally valid, depending on priorities

mhuebert18:01:00

Looking for a quick sanity check… I’ve been programming in ClojureScript all day for months, but I’m now trying to follow the Quick Start just to get a minimal cljs.js example running: https://github.com/mhuebert/cljs.js-blank just a single namespace+file with (ns blank.core (:require [cljs.js])) As it builds, I see a sea of errors like WARNING: Use of undeclared Var cljs.core$macros/…, and when I try to load the page, the first macro it tries to load throws cljs.core.defmacro is undefined in Firefox or Uncaught TypeError: Cannot read property 'call' of undefined in Chrome (on line 99 of core.cljc). Running Java 8, update 45. Am I missing something obvious?

alex-eberts19:01:35

Could someone take a quick look at this paste and tell me what I'm doing wrong?

mhuebert19:01:05

@alex-eberts (vals e) returns a list of all the values in a map

mhuebert19:01:27

likewise `(keys e) returns a list of all the keys, not just the one.

richiardiandrea19:01:15

@alex-eberts: I think you should not use (vals ..) because it returns a seq

alex-eberts19:01:36

ah.. right, I'm getting a vector wrapped in a seq... I just want the vector.

mhuebert19:01:22

you could also use a set as a function to test membership, e.g. ((set [:a :b]) target)

richiardiandrea19:01:57

definitely more idiomatic and you save an = and a % 😄

alex-eberts19:01:22

good point but I think that would fail for falsey values, no?

richiardiandrea19:01:47

in your use case should be a drop in replacement, basically being a function matching for = with all the elements in the set

richiardiandrea19:01:52

I think he was suggesting something like:

(defn seq-contains? [coll target]
  "Returns true if coll contains target, nil otherwise"
  (some #(target) coll))

alex-eberts19:01:52

hehe Andrea - I just realized that was you! Happy New Year! simple_smile

richiardiandrea19:01:30

Hey Alex, of course! I saw a buddy asking question and tried to help

alex-eberts19:01:54

Vancouver Clojure for the Win!

mhuebert19:01:04

that’s true re: falsey values

richiardiandrea19:01:51

falsey values of target?

richiardiandrea19:01:40

(sorry don't understand were the falsey value can be, maybe because I am still Sunday sleeping :D)

mhuebert19:01:11

@richiardiandrea: yeah if false or nil was the value you were testing, that’s what would be returned

alex-eberts19:01:23

from the examples on contains?:

alex-eberts19:01:27

The set-as-function shortcut will not work if you might be searching for a falsy value (false or nil). ; will not work (some #{false} [true false true]) ; = nil

richiardiandrea19:01:29

oh ok, but it should be the least possible of your use case, trapped way before with some :pre maybe

richiardiandrea19:01:33

but good to know 😄

mhuebert19:01:17

the data structure seems a bit weird, to get the name of an entity you’d need to do something like (first (keys entity))

alex-eberts19:01:33

the data structure will be a map of ids to vectors: {:e1 [:foo :bar :baz] :e2 [:foo :bar]} etc

alex-eberts19:01:55

it's the basis of a component entity system like chris granger did here: http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/

mhuebert19:01:33

would you not pass in just the val to your contains? function? eg. (when (contains-component? (:e2 entity-map)) …)

alex-eberts19:01:31

I'm passing contains-component? as a predicate to a filter function - it may be a bit of overkill but that's how it came out this morning simple_smile

mfikes19:01:35

@mhuebert: The inability to require cljs.js is really odd. I have a require on one of my blog posts and it is exhibiting the same. (http://blog.fikesfarm.com/posts/2015-09-05-runtime-macroexpand.html)

mhuebert19:01:55

@alex-eberts: note https://clojuredocs.org/clojure.core/filter#example-542692cac026201cdc326b5f - when you filter a map the predicate function is passed the key and val separately as 2 args so you could have (defn contains-component [target entity-name entity-vals] …) and then (filter #(contains-component? :target %1 %2) entity-map) for example

mhuebert19:01:59

@mfikes you mean it is doing the same thing when you evaluate run it?

alex-eberts19:01:02

@mhuebert: that’s helpful - thanks!

mhuebert19:01:23

@mfikes it’s super weird for me. And when I try to evaluate anything I get errors like WARNING: Use of undeclared Var cljs.user/fn at line 1

mfikes19:01:26

@mhuebert: If I simply start up a ClojureScript REPL, and then do (require ‘cljs.js) I get the “sea”.

mhuebert19:01:48

@mfikes has it always been this way or something recent?

mfikes19:01:31

I found that there were other errors in the past. But that’s the immediate question I had, and why I looked for evidence that I had such a require in a blog post. 😕

mfikes19:01:05

I would assert that you should be able to (require ‘cljs.js) in a REPL.

mhuebert19:01:37

hehe and, for that matter, in a fresh blank project!

mhuebert19:01:29

@mfikes bit of a random question, have you ever run into problems with Uncaught Error: No method in multimethod 'cljs.compiler/emit*' for dispatch value: errors? I get them when I use cljs/compile-str but not when I use cljs/eval[-str]. That’s what I was setting up this fresh project to troubleshoot simple_smile.

mhuebert19:01:39

I avoided them by using cljs/eval for the longest time, but now I’m trying to get better error messages via source maps, and haven’t figured out how to access the ‘maps while using eval

mfikes19:01:39

@mhuebert: no, I haven't

mfikes20:01:14

@mhuebert: If you clone the ClojureScript compiler tree, do script/build, script/bootstrap, script/noderepljs, then you will be in a node REPL that can (require ‘cljs.js). This doesn’t explain why you can’t do it with cljs.jar

mfikes20:01:10

It probably involves digging into how the analysis cache is handled when doing things in that context.

mhuebert20:01:42

hmm interesting. In the mies template it also works.

mhuebert20:01:50

and there doesn’t seem to be a whole lot going on in mies.

mhuebert20:01:13

In any case I put up a minimal example demonstrating an error handling problem with cljs/compile-str: https://github.com/mhuebert/mies-cljs.js

mhuebert20:01:26

I have yet to figure out JIRA

mfikes21:01:38

@mhuebert: I'll write a minimal ticket regarding the issue

mhuebert21:01:54

@mfikes maybe now is as good a time as any for me to figure it out simple_smile

mhuebert21:01:10

can anyone just sign up and add an issue?

mfikes21:01:58

It has been so long, I can’t recall how you get access simple_smile

mhuebert21:01:18

simple_smile I was able to sign up

mhuebert21:01:19

maybe I should add one re: cljs/compile-str errors

mhuebert21:01:58

@mfikes I just read your post about using lazy-map. Nice!

mfikes21:01:14

Yeah, general guidance on self-host defects: 1. Start the title with the prefix Self-host: 2. Add the ‘bootstrap` label to the ticket 3. Make the ticket be Minor priority.

mhuebert21:01:31

ok. I got 2 out of the three simple_smile

mfikes21:01:02

@mhuebert: Edit permission in JIRA is a little more to get (may have to ask for it if you can’t change the ticket)

mhuebert21:01:33

ok. yeah I can’t change the title

mfikes23:01:32

Credit to @sherbondy for adding tvOS support!