Fork me on GitHub
#clojurescript
<
2015-07-20
>
bbloom01:07:50

dnolen: oh yeah, so much better than cljs used to be

bbloom01:07:57

i’m finally able to set up a new project in < 10 minutes

bbloom01:07:53

but now all my projects have 4 files in the root dir: build, build.clj, repl, repl.clj

bbloom01:07:02

the extension-less ones being shell scripts

jonas03:07:55

@bbloom: I guessed that (about the syntax module) but it’s the only way for now I guess. It wouldn’t be too hard to build hiccup on top but I’m not sure if that’s the correct approach. With hiccup you end up with two different syntaxes: one for html and one for your own components. Is there are reason why div, span, etc can’t simply be functions (does this impact ability to do reference equality checks for example)?

bbloom03:07:37

@jonas totally reasonable for them to be functions

bbloom03:07:59

i just realized that it would be easier to build the vdom top-down, so i didn’t use functions since then i’d have to create an intermediate tree representation bottom-up … which is basically what the syntax module is

bbloom03:07:15

although i’ll probably define a map-based tree representation, rather than the seq-based one

bbloom03:07:41

ooor did i do that already? heh, i forget

jonas03:07:58

simple_smile I will probably try to build something out of functions. The only issue is id generation but I guess that can be a second pass over the tree

bbloom03:07:13

yeah, a second pass is reasonable, but ultimately my plan was to decouple the ID scheme from the structure of the visual tree

bbloom03:07:47

for example, scope IDs to a particular component, so that if you have an outer component render (middle {} (inner {:key “x”})) then the inner would have an id context from the outer component

bbloom04:07:02

grumble grumble slack and smart quotes

bbloom04:07:34

so instead of doing a pass over the whole tree, just do it over the output of a single component’s render

bbloom04:07:39

@jonas does that make sense?

jonas05:07:32

@bbloom: maybe, I’ll have to think about it (after work)

bbloom05:07:27

especially b/c i want to be able to support decoupling the component hierarchy from the visual hierarchy

bbloom05:07:04

for example, i was rendering some custom tooltips in react, and b/c they were child components, they messed up scrollbars and other nonsense

bbloom05:07:24

so i just made one big global tooltip component and when i want to show a tooltip, i set some global state for the “current” tooltip and rerender

bbloom05:07:56

but ideally i wouldn’t need to play that game, if components could also return more than just a single root of components

bbloom05:07:10

i could say “here’s a set of absolutely positioned sub-components on a higher layer”, for example

colin.yates08:07:55

morning all - any resources comparing hoplon and the react-based libraries? Specifically in terms of performance?

Pablo Fernandez11:07:03

Is there some clojurescript router that works without hashes?

ordnungswidrig11:07:47

@pupeno: bidi uses google closure’s history lib which can use „hidden mode“.

ordnungswidrig11:07:28

only on the clojure side.

ordnungswidrig11:07:37

But the design is very good.

Pablo Fernandez14:07:07

From bidi’s README, it looks like it’s designed for Clojure and not ClojureScript… or rather, for Ring, not… well… the browser? Does it work in both places?

Pablo Fernandez14:07:34

I wonder how silk and bidi compare.

minimal14:07:34

I haven’t tried it with cljs myself

val_waeselynck14:07:04

@pupeno: yes bidi works in the browser, I prefer it to secretary actually.

Pablo Fernandez14:07:29

After looking a bit more in detail, I think my choice will be between bidi and silk.

domkm14:07:50

@pupeno: I prefer Silk 😛

Pablo Fernandez14:07:54

@domkm: I like the driving principles for Silk, but it’s still a bit unclear to me how to use it. Is it supposed to replace Compojure on the server?

domkm14:07:20

@pupeno: It can replace Compojure on the server or it could be used in conjunction with Compojure.

Pablo Fernandez14:07:51

Are there any example projects to see how it fits with Ring and ClojureScript?

domkm14:07:46

@pupeno: Silk is for going from URL to params and back to URL, compatible with both CLJ and CLJS.

domkm14:07:38

@pupeno: Let me see if I can find some open-source examples. So that I can help better, is there a particular part that is confusing?

Pablo Fernandez14:07:18

That looks useful.

Pablo Fernandez14:07:53

The other part I’m not so sure about is how to interface with Compojure and/or Ring.

Pablo Fernandez14:07:27

Oh… and one question… are you doing doing any kind of browser history management? like bidi does?

domkm14:07:07

@pupeno: No history management ships with Silk currently. Considering it for the next version.

domkm14:07:36

@pupeno: Regarding Ring: Silk takes a URL and returns params, so to use it with Ring you create a handler that matches the URL with Silk and then uses the extracted params to form the Ring response.

domkm14:07:25

@pupeno: This is essentially what Compojure does except that it is specific to Ring while Silk is compatible with Ring but not specific to Ring.

Pablo Fernandez14:07:03

Now that bidi support clojurescript, are there other advantages of silk over bidi that I’m not seeing?

domkm14:07:06

@pupeno: Depends on what you consider advantages, I guess. Silk routes can be created and combined easily while Bidi routes are defined in one large data structure. Also, I think Bidi only deals with URL paths while Silk can match any part of the URL.

domkm14:07:45

@pupeno: Not relevant yet, but I'm excited about the next version of Silk. It should be super fast (like faster than Compojure). I just need to find time to work on it. 😞

Pablo Fernandez14:07:27

This is where I’m confused. With Compojure’s defroute, I define the path to match and the function to call. In Silk, I’m not seeing the function. Do I have to implement that dispatching myself?

Pablo Fernandez14:07:04

argh… I need to run. bbl

domkm14:07:49

@pupeno: Sort of. You implement it yourself but Silk ships with domkm.silk.serve/ring-handler helper. The names of routes in Silk can be handler functions so dispatch can be as easy as calling the matched route's name and passing in the extracted params.

Pablo Fernandez14:07:05

I'm on the street now, it's hard to navigate code on a phone so I'll look at it earlier. It would certainly help to have some of that wiring more packaged or more documented. I suppose the same thing would have to be implemented with browser history.

Petrus Theron15:07:46

Packaging production cljs artifacts: advanced cljs compilation outputs a minified .js file to a target folder, but there is also the intermediate 'out' folder with unoptimized js files inside. Is there a way to separate these two from the get-go, or am I doing something wrong with boot? I am unsure if my question pertains to cljs or boot.

Lambda/Sierra15:07:54

@petrus: The "out" folder is the :output-dir in the ClojureScript build configuration. Not sure where that lives in Boot world.

robert-stuttaford15:07:56

@petrus: for what it’s worth, i’ve just dealt with this as well, and i ended up scripting a shell script post cljsbuild to remove the out folders prior to S3 upload. only :optimizations :none actually uses those files.

Petrus Theron15:07:18

@robert-stuttaford: We use CircleCI for builds, and I was leaning toward rsync with --exclude ./out to artifacts folder.

martinklepsch15:07:21

@petrus: if you want to strip stuff from the target/ directory you could also put a (sift :exclude #”out/*”) at the end of your pipeline.

martinklepsch15:07:47

@petrus: see boot sift —help for details.

Pablo Fernandez17:07:59

I am surprised that Silk doesn’t include, out of the box, ways to connect to Ring or Compojure or Html5History and makes me wonder, how are other people actually using this library? @domkm?

juhoteperi18:07:19

@pupeno: Here's an example, using hashchange instead of html5history: https://gist.github.com/Deraen/426285564376266c675b

juhoteperi18:07:20

Oh, I see domkm already mentioned similar example.

domkm18:07:39

@pupeno: Silk was meant to be fairly low-level. It's been a frequent source of questions and confusion so I think I will include some helper functions for common uses in the next version.

magnars19:07:44

I quite like how Silk just does the routing. Using it at work. 👍 @domkm

domkm19:07:40

@magnars: Awesome! Glad to hear it. 😀

shaunlebron20:07:35

@dnolen: trying to create namespace descriptions for cljs.compiler.api and cljs.build.api but they have the same docstring. what would you say distinguishes the two?

dnolen20:07:47

@shaunlebron: I’ve gone ahead and clarified them a bit. Better more detailed docstrings still welcome.

Pablo Fernandez20:07:03

Thanks @domkm and @magnars. I'll look into those again tomorrow, hopefully more awake. 💤

dnolen21:07:19

bootstrapped ClojureScript REPL simple_smile

nullptr21:07:52

there’s a whole lotta (+ 1 1) happening right now

Chris Bidler21:07:10

I went for (doc interleave) myself

Chris Bidler21:07:01

@dnolen: thanks for the announcement and @mfikes thanks for making something so amazing for us to play with

nullptr21:07:17

(inc mfikes)

nullptr21:07:31

(inc dnolen)

nullptr21:07:34

really cool stuff

Chris Bidler21:07:55

I can really tell how used to paredit I’ve become 😛

Chris Bidler21:07:12

“oh crap, okay uh …open, open, close, open, close, close ….okay” <ret>

nullptr21:07:36

chris_johnson: surely paredit support will land in ios10

mfikes21:07:11

@nullptr: The ability to do regex forms has been fixed for quite a while. (Long lead time to get app in store.)

Chris Bidler21:07:20

by that time we might well be having this conversation in #clojureswift 😄

dnolen21:07:00

@chris_johnson: I think ClojureSwift very unlikely, no GC

gtrak21:07:11

@chris_johnson: I count them 1 2 2 2 2 1

dnolen21:07:16

well until they get GC, but I think that’s unlikely

Chris Bidler21:07:49

@dnolen: I agree that GC is unlikely, and I wasn’t being entirely serious with my suggestion.

Chris Bidler21:07:16

@gtrak: I will often count on my fingers while muttering “open …open, close …open” to myself also

nullptr21:07:05

mfikes: no worries, nothing meaningful in my life is blocked as a result :)

dnolen21:07:46

@chris_johnson: haha, hard to tell, that one has come up a few times as a serious suggestion simple_smile

wei22:07:05

is there an idiomatic way to do animations yet in Reagent? specifically, expanding and hiding blocks

shaun-mahood22:07:03

@mfikes: Replete is fantastic! Thanks!

mfikes22:07:48

@shaun-mahood: Glad you like it. There’s obviously a lot more that can be added to it. Needed to ensure it would be approved, etc.

shaun-mahood22:07:58

@mfikes: I'm pretty impressed that it even exists.

shaun-mahood22:07:03

I totally got into Clojurescript at the most exciting time.

danielgrosse23:07:14

I have a multidimensional javascript which I receive from a javascript library. While I try the (js->cljs) method I get a Uncaught RangeError: Maximum call stack size exceeded from ´´´IEditableCollection (-as-transient [coll] (TransientArrayMap. (js-obj) (alength arr) (aclone arr))))

danielgrosse23:07:40

The Objects are referencing internally to next, prev and parent. Maybe this is causing the error.

dnolen23:07:22

@danielgrosse: won’t work. You just cannot use js->cljs for that.