Fork me on GitHub
#clojurescript
<
2015-06-17
>
nullptr00:06:54

michaelr: this is common if you have split your app into multiple files -- it only reloads what has changed so if you don't change the file with om/root it doesn't re-render

nullptr00:06:28

you can add a function which figwheel always runs and put om/root in there or i believe there is some metadata you can add to the root ns to always reload that file

akiva00:06:11

You add ^:figwheel-always to the namespace statement.

mfikes01:06:48

Got @maria’s CommonJS ClojureScript compiler support working with Ambly on a device for the first time! One less hurdle. If you are interested, recorded a demo of it: https://youtu.be/CS0RU2oUq7s

jrychter10:06:05

Well, it seems I am completely stuck with "ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input" from lein. I only have one file with externs, referenced once in project.clj (as :externs). No matter where I try to place it, I get this message. And it seems to be a lein-cljsbuild problem, because I get it from lein uberjar, but lein with-profile uberjar cljsbuild once works and builds correct JavaScript. Sigh.

thheller10:06:40

@jrychter: what is the name of the extern?

jrychter10:06:30

@thheller: the file, you mean? Currently :externs ["semantic.ext.js"], although I tried various locations for it.

thheller10:06:16

these are the externs added by default

thheller10:06:46

I meant the name of the object you are writing externs for, not the filename

thheller10:06:56

not sure what causes the error in closure but that would be the first place I check

jrychter10:06:09

@thheller: the file contains a bunch of lines of the form jQuery.fn.checkbox=function(){};. But I don't think this is the problem — things do work if I just invoke lein with-profile uberjar cljsbuild once.

thheller10:06:08

haven't used cljsbuild for over 2 years, can't comment on that.

mfikes14:06:32

Exposition of how Ambly is experimentally using CommonJS lib support (towards React Native): http://blog.fikesfarm.com/posts/2015-06-17-commonjs-libs-in-ambly.html

erichmond15:06:34

has anyone experimented with using bootcards with clojurescript?

meow16:06:01

@dnolen: Interesting.

Yes, we are aiming to develop the Web’s polyglot-programming-language object-file format.

meow16:06:35

Bottom line: with co-evolution of JS and wasm, in a few years I believe all the top browsers will sport JS engines that have become truly polyglot virtual machines.

escherize16:06:34

this blog post is amazing - I'm currently watching the videos

dnolen17:06:20

@escherize: definitely a cool development but we’re definitely looking at at likely 3-4 year timeline before there will be anything worth targeting for ClojureScript

dnolen17:06:46

sounds remarkably like ClojureScript’s compilation strategy 😉

dnolen17:06:34

anybody that’s ever submitted a patch to ClojureScript or even think they may one day, #C06E3HYPR is a good place to hang

dnolen17:06:00

@alexmiller just mentioned a nice patch to unify clojure.string across Clojure/ClojureScript

borkdude17:06:00

what are the consequences/gains of having clojurescript in clojurescript?

dnolen17:06:22

no consequences since it will always be optional

borkdude17:06:28

independence of JVM?

dnolen17:06:37

gains are you can now target places the JVM can’t reach easily (Electron/Atom Shell), hopefully write scripts w/ zero startup time over Node.js, show off your library with a REPL on a public website w/o a separate compilation web service.

borkdude17:06:06

I'm just asking the obvious maybe, but doesn't Google Closure compiler use a JVM?

dnolen17:06:52

yes so Google Closure will supported but it will need to be a separate step if you want to use it

dnolen17:06:06

however for the use cases I stated above, it doesn’t really offer much value

borkdude17:06:47

yeah, I got it. cool simple_smile

andrewhr17:06:27

@dnolen: we could achieve macros in cljs, don't we? Do you think there is value on that?

andrewhr17:06:40

I'm curious about your experience

dnolen18:06:14

@andrewhr: a bootstrapped thing will never support that and in fact there will be safe guards to make it very, very hard to mix macros and runtime code.

dnolen18:06:46

because A) it’s seriously not important B) it would fork the ClojureScript world, i.e. uncompilable stuff for ClojureScript JVM

dnolen18:06:30

people will keep asking for it and the answer will always be “NO"

dnolen18:06:32

get used to it simple_smile

andrewhr18:06:26

hahaha got it

aengelberg18:06:59

Does that mean cljs-in-cljs REPLs will have no support for macros? Or can they use macros but not create them?

andrewhr18:06:37

yeah, community split makes everyone lose on the long run

dnolen18:06:56

@aengelberg: you will be able load macros just fine and even properly expand them

dnolen18:06:12

@aengelberg: none of safe guards will be unsurmountable

andrewhr18:06:14

now our tools enforce us to the data > functions > macros spectrum

aengelberg18:06:21

So were you just saying NO for "macros in cljs source code"?

dnolen18:06:34

it will just make people trying to mix code & macros into one source have to do ugly hacks

dnolen18:06:40

and every one downstream will have to adopt them.

dnolen18:06:49

so libraries that break the rules will be poisoned

dnolen18:06:29

@aengelberg: no the only thing we will prevent is mixing macros and runtime code into the same .cljs or .cljc file

dnolen18:06:40

macros will actually be present at runtime

dnolen18:06:53

we’re just going to have some static analysis to discourage mixing stages

dnolen18:06:35

that is as long as the macro files do not interact with the runtime files you’re fine - even if they both actually exist at runtime

dnolen18:06:51

this means you have something that will work for ClojureScript JVM and ClojureScript JS

dnolen18:06:00

it’s actually really important that this work

dnolen18:06:22

ClojureScript macros are not like Clojure macros, they can have the same names

dnolen18:06:38

cljs.core/+ macro, and cjls.core/+ fn can coexist

dnolen18:06:42

not possible in Clojure

dnolen18:06:00

outside of :inline construct which isn’t really the same thing.

mfikes18:06:46

Never understood that… how do you use the cljs.core/+ macro? Is it automatic?

dnolen18:06:30

since there are 2 stages (unlike Clojure), these things just never interact

dnolen18:06:32

you basically have separate non-interacting namespaces for macros and runtime stuff

mfikes18:06:40

Ahh… I think I got it: The analyzer never sees, for example defn. Macroexpansion occurs first, and after that, only specials or fns exist to be analyzed and then compiled.

mfikes18:06:03

If I’m understanding correctly (+ 1 1) involves the macro (at least initially), while (reduce + [1 1]) involves the fn.

dnolen18:06:40

mfikes: yep that’s exactly right

mfikes18:06:56

@dnolen: Thanks! I’ll add some stuff to the Wiki to help others avoid meta-circular meltdown.

mfikes18:06:33

Did my best to capture this. Feel free to correct my inaccuracies: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#macros

dmich18:06:38

So is someone writing a clojurescript package for atom now?

dmich18:06:11

Sounds like it would be easier than what the LightTable people had to do?

shaunlebron18:06:28

@mfikes, thanks for asking that question, I never made that connection with the naming conflicts between the core macros and functions

mfikes18:06:33

@shaunlebron: Yeah. I suppose it caused a question or two when you are generating your doc tooling and you see both.

shaunlebron18:06:00

yeah, I just include both sources, but default to the function implementation: https://github.com/cljsinfo/api-refs/blob/catalog/refs/cljs.core_PLUS.md

mfikes18:06:28

@shaunlebron: I bet that’s safe. If you have a name collision then it is probably only sane if the macro and function have roughly the same semantics.

mfikes18:06:29

This could be beneficial. In ClojureScript, you could support something like (map or xs) (ignoring what that really means for now).

mfikes18:06:07

In other words, if you define a macro foo and feel compelled to be a good citizen and provide a foo* function for use in cases where a macro won’t do, perhaps a foo function could be defined.

shaunlebron19:06:33

is this slack channel being archived somewhere? I feel like there’s a lot of good information here that I would like to search through someday

shaunlebron19:06:54

ugh, there’s a 10,000 message limit, but that’s a sum limit across all clojurians channels

akiva19:06:56

@shaunlebron: They all are. I’m looking for the links right now.

mfikes19:06:56

FWIW, I’ve been trying to take clarifications, etc., and incorporate them into the Wiki.

shaunlebron19:06:07

@mfikes: yeah that’s really the best idea, thanks for doing that

mfikes19:06:59

@shaunlebron: I suppose only an extremely small subset of the info here really is suitable for the Wiki. (Things that the Wiki covered, but perhaps not clearly or comprehensively.) But, you are right that some odd side things are best just being searchable.

shaunlebron19:06:02

love the integrated google search, someone gave this some thought

akiva19:06:30

I’m pretty sure @ul’s behind the curtain.

denik19:06:14

that’s awesome @mfikes thank you!

shaunlebron19:06:40

@akiva, added a wiki link to the chat logs, could be useful: https://github.com/clojure/clojurescript/wiki#chat

shaunlebron19:06:33

I wonder if this has supplanted irc

akiva19:06:11

I’ve heard that it has died down there somewhat.

dnolen19:06:54

that’s hard to say, there are as many lurkers on IRC as before Slack, ~200 simple_smile

markstang19:06:02

@dnolen: How is the port of core.logic to ClojureScript going?

dnolen19:06:42

@markstang: it works, I haven’t touched it in a while and probably won’t have time to any time soon.

dnolen19:06:08

I’ll probably revisit a little bit when CLJS can compile itself as an online CLJS mK would be fun

nicmcphee19:06:22

@akiva: Do you know if Log Bot is a thing that can be leveraged elsewhere? I’m working with another group that’s considering using Slack, but people there really want logging and this looks like it might help a lot.

markstang19:06:03

@dnolen: I am sure the “Dr’s” would love an online ClJS mK. I think they were asking about it a while back...

akiva19:06:16

@nicmcphee: I’m pretty sure it could be. It just needs to be installed and configured.

nicmcphee19:06:27

@akiva: That rocks – thanks for the pointer!

akiva19:06:41

My pleasure.

aengelberg20:06:42

Is there a way (or roadmap) to get the terminal to recognize clojurescript test suites failing as a nonzero exit code?

aengelberg20:06:04

Currently CI systems will accept it even if they do lein cljsbuild test and get failures on the node output e.g.

aengelberg20:06:01

I'm not even sure which component (clojurescript, cljs.test, lein-cljsbuild) can be improved to make that work properly...

Petrus Theron20:06:45

Is there a good reagent example of a reusable dynamic list component, something where items get added/updated/removed, and the values have to bubble up to the parent container? Specifically, is there a clean way to update changes in a vector without contaminating the line components with parent state?

dnolen20:06:03

@aengelberg: this seems very specific to the runner you are using and very little to do with ClojureScript. When your tests are done invoke the proper exit (with code).

aengelberg20:06:51

that's what I'm curious about... how to exit with a code?

aengelberg20:06:25

maybe there's a way to do that specific to node.

dnolen20:06:53

stuff like this

aengelberg20:06:53

Sweet. So that would be translated to (.exit js/process 1)?

phil20:06:51

Just asked in #C0617A8PQ, perhaps more relevant here; do cider and the figwheel repl play nicely, or do people tend to drop back to inf-clojure?

dnolen20:06:23

still haven’t heard many confirmed reports of it working using all up-to-date dependencies

phil20:06:02

Righto, thanks.

dnolen20:06:18

inf-clojure definitely works as does anything that supports inferior-lisp like interaction, Cursive and I assume Sublime

phil20:06:37

Yea, inf-clojure does the trick.

aengelberg21:06:49

Can't figure out why my defmethod isn't working here (per cljs.test wiki instructions).

cljs.user=> (require '[cljs.test :as t :refer-macros [deftest]])
nil
cljs.user=> (deftest my-test (t/is (= 1 2)))
#'cljs.user/my-test
cljs.user=> (defmethod cljs.test/report [:cljs.test/default :end-run-tests] [m] (println "Look what I found" m))
#<[object Object]>
cljs.user=> (t/test-ns 'cljs.user)

Testing cljs.user

FAIL in (my-test) (at /home/alex/git/instaparse-cljs/.cljs_node_repl/cljs/test.js:384:41)
expected: (= 1 2)
  actual: (not (= 1 2))
nil

dnolen21:06:20

@aengelberg: try t/run-tests instead of t/test-ns

aengelberg21:06:38

cljs.user=> (t/run-tests 'cljs.user)

Testing cljs.user

FAIL in (my-test) (at /home/alex/git/instaparse-cljs/.cljs_node_repl/cljs/test.js:384:41)
expected: (= 1 2)
  actual: (not (= 1 2))

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
nil

aengelberg21:06:24

Doesn't work on nashorn repl either

cljs.user=> (t/run-tests 'cljs.user)

Testing cljs.user

FAIL in (my-test) (at <anonymous> (.cljs_nashorn_repl/goog/../cljs/test.js:NaN:384)
expected: (= 1 2)
  actual: (not (= 1 2))

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
nil

dnolen21:06:41

@aengelberg: what version of ClojureScript ? 0.0-3308?

dnolen21:06:07

pretty sure this works as it was added by people who needed it

aengelberg21:06:09

How are the version numbers determined? I'm just curious since they look rather arbitrary

aengelberg21:06:07

Now I'm getting:

Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/util__init.class or cljs/util.clj on classpath: , compiling:(cljs/closure.clj:1:1)
possibly because clojure/cljs/util.clj got moved to util.cljc?

aengelberg21:06:55

or I need clojure 1.7.

aengelberg21:06:55

yup, that's it.

samflores21:06:26

@aengelberg the version number is the number of the commit

aengelberg21:06:34

aha. thanks.

dnolen21:06:53

AMD Module processing landed simple_smile thanks again @maria

martinklepsch21:06:37

@maria is on a roll! 🎢

maria21:06:10

Wow, that was fast, I just uploaded the patch 20 minutes ago…thank you for merging @dnolen simple_smile

martinklepsch21:06:01

Probably a question that has been answered multiple times by now: does AMD/CommonJS support mean we don’t need externs when we have JS in those module formats?

martinklepsch21:06:28

What does “might” mean in that context?

dnolen21:06:09

you will need externs if the library is going to do something dynamic w/ strings & Object properties

dnolen21:06:04

fortunately that doesn’t seem quite so common as it once was at least for major libraries

martinklepsch21:06:43

Ah, I now remember reading that in the scrollback some day, thanks

maria21:06:53

@martinklepsch: Here is a simple example for when you would need externs:

greeting["bye"]  = function(name) {
        return "Bye, " + name;
    };

maria21:06:53

And also reading this might help to understand when you need externs: https://developers.google.com/closure/compiler/docs/limitations

maria22:06:01

> The Compiler renames properties in Advanced mode, but it never renames strings.

dnolen22:06:09

@martinklepsch: thanks to the vagaries of JSPerf abuse there’s now a useful myth that .foo is faster than [“foo”]