Fork me on GitHub
#clojurescript
<
2015-08-05
>
maria00:08:42

Ok, so I moved the project templates right under tutorials and included a link to it in the sidebar under additional information. And deleted the page I previously created, since it would be redundant. Hope that’s ok.

dnolen00:08:12

I went ahead and a added a new section right after the templates called “Getting Help” which includes links to IRC/Slack and the mailing lists.

dnolen00:08:19

other suggestions welcome!

dnolen00:08:20

somebody needs to do this for ClojureScript https://github.com/servant-app/JAWS simple_smile

pre00:08:13

@dnolen: I’m happy to take over mies-om lein template

pre01:08:23

@mhuebert: I couldn’t follow your intent for cells, but I like what I’ve seen so far

pre03:08:57

Can anyone with experience migrating cljx to cljc (1.7) advise on what’s wrong with the this?

pre03:08:02

(ns garden.util
  "Utility functions used by Garden."
  #+clj
  (:refer-clojure :exclude [format])
  (:require
   [clojure.string :as string]
   [garden.types :as t]
   #+cljs [goog.string]
   #+cljs [goog.string.format])
  #+clj
  (:import garden.types.CSSAtRule))

pre03:08:24

(ns garden.util
  "Utility functions used by Garden."
  #?(:clj
     (:refer-clojure :exclude [format])
     (:require
      [clojure.string :as str]
      [garden.types :as t])
     (:import garden.types.CSSAtRule))
  #?(:cljs
     (:require
      [goog.string]
      [goog.string.format])))

pre03:08:44

I get the error

pre03:08:50

clojure.lang.ExceptionInfo: Feature should be a keyword: (:require [clojure.string :as str] [garden.types :as t]) {:type :reader-exception, :line 7, :column 28,

pre03:08:01

I solved it: looks like you have to pass a single form and not multiple forms to each literal

pre03:08:15

(ns garden.util
  "Utility functions used by Garden."
  #?(:clj
     (:refer-clojure :exclude [format]))
  #?(:clj
     (:require
      [clojure.string :as str]
      [garden.types :as t]))
  #?(:clj
     (:import garden.types.CSSAtRule))
  #?(:cljs
     (:require
      [goog.string]
      [goog.string.format])))

Petrus Theron07:08:10

Now that ClojureScript can compile itself, will browser-repl behaviour change in figwheel or boot? I.e. no more (start-repl)?

exitcode011:08:25

Can anyone tell me why someone would want to break up a task that would fit into one component -- into many components? And use core.async instead of just using 'this' in render_state and not having to do any communication? https://github.com/jackschaedler/goya/blob/master/src/cljs/goya/components/palette.cljs

robert-stuttaford12:08:29

@andrewmcveigh: another cljs-time question for you simple_smile

angusiguess12:08:42

@exitcode0: Maintainability, mainly? If changes had to be made to some smaller part of the application you can change the components that are children of the main component without having to change the overall app representation. If each component is separated by a channel, there's a clear separation between what they represent and how they can change the app.

robert-stuttaford12:08:20

@andrewmcveigh: i’m getting different values between :none and :advanced optimisation (with pseudonames) output. :none: #object[Object 20150705] :advanced #object[$goog$date$Date$$ 1436047200000]

angusiguess12:08:48

You could write one large component and operate directly on the state but then every component owns its lifecycle, how it represents data, and how it changes data. This would likely get more difficult to maintain over time.

andrewmcveigh12:08:14

@robert-stuttaford: Do you think you could raise a github issue? Don’t have time to look at it right now.

robert-stuttaford12:08:48

sure thing. i think i know why we’re struggling. we’re base64 encoding so that we can put it on the querystring along with some other stuff

andrewmcveigh12:08:22

Thanks, busy day today 😕

angusiguess12:08:25

@exitcode0: Also goya was written before reference cursors existed in om, so they used a bunch of channels to process messages from each component.

dnolen13:08:40

@petrus no changes to builtin REPLs in the near term

exitcode013:08:39

@angusiguess: I am looking at a 75 line long component with a 64 line long render function (http://pastebin.com/Sy4hL8Fg)

exitcode013:08:01

would the added lines and complexity with channels and division among components, in your opinion, be worthwhile in my situation?

bhauman13:08:45

@shaunlebron: if you need me to make adjustments to Figwheel for your book, then those adjustments are probably good for everyone, feel free to make an issue or send pull requests.

bhauman14:08:16

@shaunlebron: I'm sailing for the week so I'm a bit out of touch. So much is happening!! It's awesome!

shaunlebron15:08:43

@bhauman: thanks, I don’t quite know the appropriate questions to be asking, but they have to do with integrating figwheel with the quick start build scripts somehow. haven’t looked at figwheel source in a while

shaunlebron15:08:22

I’ll make a note to check that out

shaunlebron15:08:38

@dnolen: I wanted to make a note about the earmuffs naming convention. I noticed that cljs.js/*loaded* cljs.core/*unchecked-if* cljs.core/*main-cli-fn* cljs.core/*clojurescript-version* are not dynamic vars. Should I say it’s a special global var naming convention sometimes?

dnolen15:08:25

@shaunlebron: there will always be exceptions to the rule but I would not explain this subtlety to a new user

dnolen15:08:54

it’s telling that all the real examples you listed above are all more less private except for *clojurescript-version*

shaunlebron15:08:42

yeah, I won’t be explaining that for new users, will just make a note of the exception for completeness in the reference docs

dnolen15:08:44

@shaunlebron: also for consistency it probably makes sense to mark the ones we can as ^:dynamic there’s really no good reason that they aren’t.

sisawat15:08:46

Can anyone recommend an all-clojurescript front end framework that consumes json?

sisawat15:08:18

I am plotting to get clojure into my workplace.

roberto15:08:02

you can use cljs-http or cljs-ajax to consume json/edn/xml

shaunlebron15:08:47

@sisawat: haven’t read through this yet, but @escherize told me good things about re-frame: https://github.com/Day8/re-frame

sisawat15:08:19

That looks like exactly what I was after

roberto15:08:21

yeah, I highly recommend re-frame

sisawat15:08:50

many thanks

shaunlebron15:08:16

@sisawat: keep your eye on Om Next too

sisawat15:08:32

Have used a bit of om with figwheel

hmadelaine15:08:19

Hi everyone ! I am porting a ClojureScript project from 0.0-3308 to 1.7.28 but my project do not compile because I use cljs.repl/source is there an obvious reason or do I have to dig ? Thank you for your help

sisawat15:08:24

We have a ruby app with a fairly rich API, and a rebranding task ahead of us and we just lost three devs, so I see some opportunity here.

shaunlebron15:08:41

@sisawat: can be hard to sell, but we’re working on making that easier with a central site

sisawat15:08:42

Indeed. In any event though, these are all helpful suggestions.

shaunlebron15:08:12

@hmadelaine: yeah, (cljs.repl/source +) runs fine on 0.0-3308, but dumps an exception on 1.7.28

hmadelaine15:08:42

@shaunlebron: Ok so I am not alone in the dark 😉 Thanks

shaunlebron15:08:44

that’s one worth filing an issue

escherize16:08:43

re-frame's pretty cool. it's got RFP and stuff.

dnolen16:08:51

filed, will probably cut a release for any other regressions like that may have cropped up

hmadelaine16:08:09

thanks @dnolen I am going to watch this one

escherize16:08:56

@sisawat: I've had success with adoption by showing people reagent + reagent-cookbook.

sisawat16:08:17

Ahh that’s pretty good too

jhchabran16:08:31

@sisawat: would advise taking a look at re-frame too, its readme was what convinced the other dev I’m working with to get into the clojurescript bandwagon

escherize16:08:53

yeah, @jhchabran - that readme changed my life

jhchabran16:08:09

it’s actually changing mine 😄

escherize16:08:42

It sounds really weird, but I now understand the meaning of gospel

sisawat16:08:45

@jhchabran: yeah was reading that

jhchabran16:08:16

@sisawat: anyone that had coded UIs has at some point experienced some major pain dealing with state and cluttered code resulting from its poor management, while om/reagent already address these, re-frame’s README really takes time to take you by the hand and walk through it carefully

ericfode16:08:52

I am still struggling to get datascript to work in that framework though...

ericfode16:08:57

has anyone else had success?

jhchabran16:08:12

especially since it helps structuring your app, which is what I personally felt a bit daunting when I got started

roberto16:08:28

The awesome thing about re-frame’s README, is that it not only explains the why in a very approachable manner, but it also shows the how.

jhchabran16:08:46

@ericfode: didn’t try yet, but will clearly do at some point

ericfode16:08:32

I would love to hear about your experience when you do simple_smile @jhchabran

roberto16:08:40

I haven’t worked with datascript, but I would imagine it would be similar to fetching data via xhr. It is basically something external that a dispatch could invoke….

roberto16:08:59

but then again, I have 0 experience with datascript, but that is how I would try approaching it if I had to..

ericfode16:08:44

That was my thought as well, my problem was that re-frame likes to deref the reference to my datascript db when it passes it to the handler

ericfode16:08:52

and then swap it when the handler is done

ericfode16:08:04

while datascript perfers to hold onto the atom it’s self

ericfode16:08:57

I tried having the datascript atom just be an atom in the db namespace with a global reference… but that kinda feels like i’m missing the point...

roberto16:08:01

looks like it is not as straightforward as I thought

ericfode16:08:59

@roberto I have and used it else where, It is awesome. Thanks for posting it!

escherize16:08:20

that is very interesting

shaunlebron16:08:09

@dnolen: RE: ^:dynamic labelling, I think there are just cases where earmuffed vars are just things that can be set!, like *main-cli-fn* in https://github.com/clojure/clojurescript/wiki/Quick-Start#running-clojurescript-on-nodejs

shaunlebron16:08:54

I just think that labeling them as dynamic would miscommunicate the intention

shaunlebron16:08:31

I don’t have much experience with them though

dnolen17:08:59

@shaunlebron: that’s valid too, it’s a minor thing really

dnolen17:08:03

awesome stuff

dialelo17:08:46

wow, an embedable CLJS playground would be huge. @jonas are you working on it?

jonas17:08:08

@dialelo: Not right now.. but I have done some experiments in the past with http://cljsfiddle.net. It desperately needs updating with the latest cljs features (including self-hosting)

sisawat17:08:27

Even if that’s limited that’s a godsend

dialelo17:08:44

yes, that'd be nice

dialelo17:08:10

@niwinz and i want to start a blog to write articles about CLJS that complement the book

dialelo17:08:49

and being able to compile, modify and run examples interactively would be great

tomayerst18:08:46

Hi, I am struggling with getting an SVG grag to work properly

tomayerst18:08:00

It is a mod of the reagent SVG example

tomayerst18:08:29

The issue is that the .startDrag function never gets called so the object always shunts itself off to the top left...

tomayerst18:08:54

I was wondering why?

dnolen18:08:51

unzip a JAR inside the browser https://gildas-lormeau.github.io/zip.js/, this plus bootstrapped ClojureScript - minds will be blown simple_smile

bensu18:08:32

@tomayerst: If I recall correctly the .startDrag event works for nodes that have a goog.fx attached to them. try simple goog.events.EventType.MOUSEMOVE and MOUSEUP

bensu18:08:26

the repo is very much WIP, but the event handlers are the same.

isaac_cambron18:08:22

I’m really exited about self-hosted cljs, mostly for what I assume will be a huge compile-time speedup. What I don’t have a good grasp on is what the state-of-the-art tooling is. I mean, I use lein-cljsbuild now (I have to compilation targets with a bunch of shared code, which doesn’t seem to be a great fit for lein-cljsbuild anyway), and I’m not sure what to replace it with in Node-hosted land. I understand that 1.7 is hot off the press, so maybe the answer is, “Dude, it’s coming! Be patient!”, but if that’s not true, I’d love to hear about the alternatives. I’m also happy to contribute, but I’m not even sure what to contribute to. So what’s the lay of the land?

dnolen19:08:37

@isaac_cambron: it’s significant compile time slow down not speed up

dnolen19:08:59

JS engines are consistently 1.5-3X slower than the JVM even after lots of hand tuning by yours truly

Joe R. Smith19:08:58

@dnolen … and then 20 years later we’re back to deploying apps on the web via jars (and not quite the way Sun had in mind…)

dnolen19:08:00

replacing the existing tooling for the traditional use case makes no sense at all to me

isaac_cambron19:08:07

Hmm, OK. I guess there are two things that are slow: 1. process start-up time, 2. actual compilation time. I sort of combat 1 with :auto but I restart the process enough that it’s sort of a painful workflow. Sounds like the self-hosted option doesn’t help with 2, but perhaps it helps with 1?

bensu19:08:28

@isaac_cambron: you are right. node has faster startup times and consumes less memory than the JVM. If you are restarting the process a lot due to "bad-state" and not some other build step, you should consider changing your compiler options or using cljs.build.api without cljsbuild

bensu19:08:57

regardless, today cljs tooling is centered around the JVM, and using node would require lots of rewrite/adaption.

dnolen19:08:44

@isaac_cambron: lein adds considerable amounts of overhead to any workflow, you can gain a lot just by dropping it and using a custom build script.

dnolen19:08:01

also ClojureScript is available in AOT, which cuts out like 4 seconds of compile time.

isaac_cambron19:08:30

ok, thanks @bensu and @dnolen, that’s great info

dnolen19:08:02

@isaac_cambron: one my work machine doing this means recompilation starts in around 1.5s instead 7-10 or whatever

isaac_cambron19:08:59

writing a custom build script sounds to using the jvm-based compiler sounds like the thing to do

dnolen19:08:02

for larger projects restarted build still need to read analysis caches, been pondering that - likely will involve something around transit encoding

dnolen19:08:48

a pro-tip - enable :verbose true to get a sense of what the compiler is doing.

isaac_cambron19:08:59

i guess my hesitancy is that, greedily, I also want the :auto-style watch stuff, and that seemed complicated to implement. maybe if restarting is fast enough, it doesn’t matter

dnolen19:08:13

by doing that you’ll see if you’re doing something weird like including tests on your classpath all the time or using an optimization setting when you shouldn't

isaac_cambron19:08:26

good tip, i’ll definitely do that

dnolen19:08:36

@isaac_cambron: ClojureScript has had built in watch support for months now

isaac_cambron19:08:55

oh neat. see, that’s the stuff i don’t know

dnolen19:08:02

the only thing lein-cljsbuild really does anymore is add the convenience of configuration inside your project.clj

dnolen19:08:12

but I’m not sure this is a good idea anymore

isaac_cambron19:08:22

ok, yeah, i should go read up on just using the straight-up tools

dnolen19:08:49

with @maria’s work on including arbitrary JS transforms getting this into a declarative form inside project.clj will probably be more trouble than it’s worth

bensu19:08:58

@isaac_cambron: yes! read the QuickStart! (that is always the response simple_smile )

bbloom19:08:05

@dnolen: Is theres something i can do to make core.match more cljc friendly? In particular, i want to define a macro which expands to use core match, but i want to use that macro from both clj and cljs

isaac_cambron19:08:19

my cold-start compile is 45 seconds. my watch compile is 11 seconds. i definitely feel like I could improve that

bbloom19:08:34

(without having to write separate macros and infect every consuming ns w/ two conditional requries)

dnolen19:08:42

@bbloom: oh huh, I should probably cljc-ify that

dnolen19:08:46

would be simple

bbloom19:08:58

@dnolen: i would greatly appreciate it simple_smile

isaac_cambron19:08:08

ok, thanks for the help!

dnolen19:08:32

@isaac_cambron: that seems really, really long to me. how fast is your machine? I would definitely recommend turning on :verbose true to figure out what’s going on

dnolen19:08:36

also if someone wants to give me a patch for this would happily take it simple_smile

dnolen19:08:39

this is newbie friendly one

isaac_cambron19:08:44

it’s a modern macbook pro, but i’m running the compiler inside a docker container inside a VM, so…i’m not sure

isaac_cambron19:08:52

but the project isn’t like huge or anything

bensu19:08:53

@dnolen: cljc match, is it a matter of smashing the namespaces into one cljc file, or of producing an cljc api file that conditionally consumes the relevant namespaces?

isaac_cambron19:08:01

so yeah, i’ll try :verbose

dnolen19:08:17

@isaac_cambron: huh, not sure why you need docker for JVM stuff, but perhaps you have your reasons

dnolen19:08:58

@isaac_cambron: ok, just sounds like a really complicated setup to me, will definitely introduce it’s own overheads

isaac_cambron19:08:24

well, i still try to optimize the things i can

dnolen19:08:08

@isaac_cambron: other thing is to make sure you giving the JVM plenty of ram, anything less than 1gb is a bad idea - for advanced compilation 2gb

dnolen19:08:22

for large projects anyway

isaac_cambron19:08:42

@dnolen: Yeah, it has that and more

isaac_cambron19:08:22

I’ll check out :verbose, run it bare-metal so I can apple-to-apples, try ripping out lein, etc.

isaac_cambron19:08:42

If I still have bad perf, I’ll come back and ask more

bbloom19:08:20

the jvm defaults for lein are a constant pain 😕

bbloom20:08:32

@dnolen: also worth noting, core.match in cljs mucks up source maps - presumably due to metadata handling in the macro

bbloom20:08:47

otherwise: working great simple_smile

bbloom20:08:55

this is the first time i’ve actually had a use for core.match

dnolen21:08:25

Clojure/conj 2015 (http://clojure-conj.org) will be held in Philadelphia, PA from Nov 16-18! The Clojure/conj 2015 CFP is now accepting talks until August 14th - topics may include experience reports, language usage, tools, libraries, or other creative uses. https://cognitect.wufoo.com/forms/clojureconj-2015-call-for-presentations/ Talks will be 40 minutes in length. All speakers receive a conference ticket, up to 4 nights lodging at the conference hotel () and airfare stipend (U.S. airfare or up to $550 international). If you have questions or want feedback prior to submitting, please contact <mailto:[email protected]|[email protected]>.

dnolen21:08:33

send in your talk ideas!

roberto21:08:56

I need to plan my year better so I can make it to the conj or clojure west next year. Will miss it by a month this year.

nodename22:08:30

@mfikes brew install planck gives me an error "No available formula"

mfikes22:08:01

@noisesmith: Did it say anything about doing brew update to update formulas?

noisesmith22:08:13

oh that reminds me I was going to install planck on the osx work machine

mfikes22:08:17

(Sorry for the summoning @noisesmith 😞 )

nodename22:08:46

@mfikes it did not mention that, but now I've done it and planck was found

mfikes22:08:17

@nodename: Cool. To be honest, I’m not too savvy with Homebrew myself. simple_smile

dnolen22:08:10

Just released ClojureScript 1.7.48, mostly small fixes & enhancements

dnolen22:08:33

@hmadelaine: the above includes the fix to cljs.repl/source