Fork me on GitHub
#clojurescript
<
2015-12-22
>
sventechie00:12:25

@firinne for a lot of the basics, you might find Luminus useful — it even has some helpful overview of ClojureScript and its tooling http://www.luminusweb.net/docs/clojurescript.md

dnolen15:12:21

this was supposed to be a talk mostly on Om Next but it ended being a pretty good history of ClojureScript https://www.functionalgeekery.com/episode-40-david-nolen/ for those who are curious

glenjamin16:12:14

cheers for the dependency hint yesterday btw dnolen - I managed to get things working

glenjamin16:12:38

it’s a shame I have to share stuff via js/window - but i’ll leave figuring that out for another day

dnolen16:12:12

@glenjamin: glad I could help

a.espolov16:12:48

use :advanced mode compilation cljs build project https://github.com/callemall/material-ui with dependency react added js file to :externs compiler get warnings "React is not defined in the externs."

a.espolov16:12:59

code in browser does not work

jaen16:12:52

They are already wraped for your convenience.

a.espolov16:12:29

this examples use :optimizations :none

roberto17:12:52

nice, I’m waiting for the David Nolen episode to land on iTunes. It tends to land a little late. The Phillip Wadler interview hasn’t landed yet either 😞

staypufd17:12:03

Hello all - I was reading a article about WebAssembly and was wondering if that is going to matter much to ClojureScript and making it faster, etc?

thheller17:12:06

@staypufd: too early to tell but I imagine we will do everything to get the most out of it once WebAssembly is stable and widespread

dnolen18:12:40

@staypufd: WA integration is likely to be years away, it presents many new challenges none which anyone has any answers for

dnolen18:12:24

@staypufd: in the meantime it’s already possible to get within 1.5X-2X of Clojure JVM so we’re already in ridiculously fast territory

staypufd19:12:23

Thanks for the replies!

staypufd19:12:05

For sure I’ve never had ClojureScript be the slow part of my apps.

serce21:12:22

Is there any way (macro-way) to replace reagent "reaction" syntax to any kind of reactive-destructuring?

serce21:12:24

(let [name (reaction (:name @this)) type (reaction (:type @this)) separator (reaction (:separator @this)) value (reaction (:label @this))] (fn [] ))

juhoteperi21:12:00

@serce: That example doesn't look very useful. Just deref this in render fn without reactions?

serce21:12:49

@juhoteperi: "this" is not final structure, it has children and i don't want to re-render all tree if one of my children changed

serce22:12:19

And name, type and value isn't just primitives, it is data for components

juhoteperi22:12:45

@serce: Okay, maybe using select-keys in reaction and dereffing and destructuring in render would make sense then

serce22:12:04

@juhoteperi: But in this case "name" changing will lead to re-rendering "value" component, i think some kind of macro is only solution

juhoteperi22:12:25

@serce: The example is not enough to demonstrate what you are trying to do and you are maybe too careful about not rerendering stuff, I have never hit performance problems caused by parent components being rerendered unnecessarily

juhoteperi22:12:41

Also, Reagent 0.6 track might make this simpler.

serce22:12:30

@juhoteperi: thank you, i will look into it

dnolen22:12:15

up till now timestamps were not handled properly for detecting changing dependencies

dnolen22:12:33

this fix should mean you should be able to change dependencies without having to blow away your build

dnolen22:12:03

needs testing since it’s touched a bit of code so if you know how to use master on your projects give it a spin

dnolen22:12:55

it would be nice to have people try to develop without destroying their caches during dev - any discovered issues will now be considered major

mitchelkuijpers22:12:18

I think I found a bug in clojurescript this:

#([:form-builder/request-form-success formtype %])
compiles on clojurescript 1.7.170 with optimizations none. On advanced compilation this breaks (as it should)

dnolen22:12:09

@mitchelkuijpers: that’s not really a “bug"

dnolen22:12:47

there’s absolutely no reason that shouldn’t compile as far as Clojure is concerned

lvh22:12:08

is there a way to automatedly run tests in a browser that preserves reasonable tracebacks?

lvh22:12:18

I’m using doo, but I get totally useless errors back

lvh22:12:32

like actual: #object[Error Error: No item 1 in vector of length 1]

mitchelkuijpers22:12:14

@dnolen: Hmm.. you’re right that should compile, but on clojure you would get a

ArityException Wrong number of args (0) passed to: PersistentVector  clojure.lang.AFn.throwArity (AFn.java:429)

dnolen22:12:59

@mitchelkuijpers: variety of reasons why that is easy to do in Clojure and less easy to do in ClojureScript

dnolen22:12:01

anyways not a bug

mitchelkuijpers22:12:11

But on clojurescript with optimizations none it actually works and then on advanced it breaks with a

Uncaught Error: Invalid arity: 1

dnolen22:12:05

@mitchelkuijpers: I don’t know what you mean that it “breaks" on advanced

dnolen22:12:08

at runtime?

mitchelkuijpers22:12:41

@dnolen: Sorry I am not being very clear, on advanced compilation this gives a runtime error while it works at runtime in optimizations none.

dnolen22:12:05

@mitchelkuijpers: I’m skeptical that error is what you think it is

dnolen22:12:10

first off it doesn’t make any sense

mitchelkuijpers22:12:14

And this does not work at runtime on clojure either

dnolen22:12:20

the vector is of length 2, being given 0 arguments

dnolen22:12:26

so the error doesn’t even match the code

dnolen22:12:41

so either your report is missing a lot of information - or the advanced error is the actual bug

mitchelkuijpers22:12:22

on clojure this

(#([1 %]) 2)

mitchelkuijpers22:12:36

gives:

ArityException Wrong number of args (0) passed to: PersistentVector  clojure.lang.AFn.throwArity (AFn.java:429)

mitchelkuijpers22:12:45

clojurescript gives this error at runtime on advanced compilation

Uncaught Error: Invalid arity: 1

mitchelkuijpers22:12:04

@dnolen That is the smallest example I can give, does this make any sense?

dnolen22:12:40

@mitchelkuijpers: feel free to open a minor ticket

dnolen22:12:54

the ticket will need a lot more information before it will be looked at though

mitchelkuijpers22:12:33

Does not seem very important indeed, but it broke our production release today, anyway thank you for your help

dnolen22:12:27

@mitchelkuijpers: I also can’t reproduce your issue

dnolen22:12:43

I see a runtime error for that in a REPL, nothing to do w/ :advanced

dnolen22:12:52

(I mean I can’t reproduce the details of your issue)

jannis22:12:02

Is there any good way in ClojureScript to parse and format a date string like "2016-01-13T00:00:00-0800" such that it renders with a timezone name (e.g. PST). Ideally, I would like it to get the following string out: "Wed, Jan 13 2016 0:00 AM PST".

dnolen22:12:27

@jannis I would look at Google Closure Library for that stuff

jannis22:12:25

@dnolen: Mhm. I did try my luck with moment and cljs-time, no look and now I am looking at the things in goog.date.

mitchelkuijpers22:12:43

@dnolen: Hmm you’re right I get the same error in the repl, sorry for wasting your time

angusiguess22:12:49

> (macroexpand '(#([1 %]) 2))
((fn* [p1__21615#] ([1 p1__21615#])) 2)
> (macroexpand '((fn [x] [1 %]) 2))
((fn [x] [1 %]) 2)

dnolen22:12:33

@mitchelkuijpers: it’s definitely a bug

dnolen22:12:50

we reuse the dispatch logic from fns for collections and the count is off in this case

mitchelkuijpers22:12:28

@dnolen: Glad I haven’t wasted your time then simple_smile

richiardiandrea23:12:35

I so like Clojure(Script) !

richiardiandrea23:12:18

Thank y'all guys!

mitchelkuijpers23:12:18

Thanks @dnolen much appreciated

jannis23:12:23

@dnikita: Mh, DateTimeParse is also what cljs-time uses internally. It doesn't like this kind of time zone offset it seems: https://gist.github.com/Jannis/07de0f4069ecf5f856d9 - that shouldn't be +01:00

jannis23:12:33

Unless the Z is wrong in the pattern.

jannis23:12:44

Oh, actually... my local time zone is +0100 and it has translated the time from 00:00:00 to 09:00:00. So it's all correct. I've always found the tz stuff so confusing.