Fork me on GitHub
#clojurescript
<
2021-01-05
>
kosengan08:01:41

Would be helpful if someone who has tried out all of these and has strong opinion on them 🙂

yogidevbear09:01:51

@thegobinath I haven't used helix myself, but a work colleague has and seems to have positive things to say about it. You might have better luck asking for insights around it in #helix

kosengan09:01:35

@yogidevbear for now, my idea is that, helix is a tiny library that is basically about hooks and uix is most of the other aspects of the react with its recent updates

yogidevbear09:01:11

Possibly. I don't have personal experience with either of these projects so can't confirm either way 🙂

lilactown16:01:03

In helix’s docs there’s a page “Why Helix?”

lilactown16:01:43

Is there anything I could add that would make if clearer what it’s for?

kosengan04:01:04

• I have actually read that and it is clear enough 🙂 • It's just that, Helix and other libraries tries to achieve the same - on the surface • But on digging further one can get an idea how they differentiate • AFAIS, Helix is tiny/minimal library

dnolen13:01:06

Also, Reagent still works well, haven't tried the others

dnolen13:01:30

One of the biggest improvements to ClojureScript UI dev wasn't a CLJS library on our project - it was Storybook - https://storybook.js.org

dnolen13:01:03

some of this is possible w/ Devcards but Storybook has a mode optimized for React Native, so you can really "preview" the app and test the components in the simulator and on the device

dnolen13:01:29

the other thing here was needing to work w/ devs and designers who were learning ClojureScript - but knew JS / React / CSS etc. well

dnolen13:01:19

so we just write pure components in JS, which is fine - and then we put the app together in ClojureScript

dnolen13:01:58

one huge benefit is that it becomes obvious what the app actually does because there's only high level code

dnolen13:01:07

no component stuff, no styling

dnolen13:01:48

only business logic & state

p-himik14:01:46

That's pretty cool, thanks for sharing. Before this, I was thinking of Storybook only as of another way to document and present your components.

dnolen14:01:34

@p-himik I think Storybook is like TDD for UI, I wouldn't do another project without it

dnolen14:01:03

the JS / ClojureScript split has a secondary benefit in that you really can't get lazy about state management since you have a hard barrier

dnolen14:01:25

everything in Storybook has to be completely decoupled from everything, can't get lazy

dnolen14:01:15

the end result is that there are much, much fewer bugs than in other UI projects I've worked on

dnolen14:01:41

Storybook proves the component can do what it's required to do in complete isolation

dnolen14:01:57

and the ClojureScript bits are only about essential state management

p-himik15:01:46

I imagine if a project is 100% CLJS, it will be harder to draw that boundary between what should be a component on its own that deserves a place in a storybook and the rest.

dnolen14:01:32

and you're not wading through irrelevant styling gunk

Michaël Salihi14:01:44

Very interresting feedback, thank @dnolen! All this set up within Krell?

dnolen14:01:13

yes but Krell is really just a REPL, the build stuff is just plain old ClojureScript

dnolen14:01:21

Krell is only needed when releasing because of React Native assets for advanced builds

dnolen15:01:23

the only true custom pass

dnolen15:01:00

all the stuff about pulling everything together is just standard tooling including leveraging :bundle

👍 3
Michaël Salihi15:01:05

Yes, that's why Krell is great, a thin layer over Reat Native 👍

Alexis Vincent15:01:38

@dnolen given :bundle, where do you think the barriers still are between cljs and the js world? Friction wise

dnolen15:01:17

I haven't personally encountered any issues

dnolen15:01:29

we've written components, leveraged RN components

dnolen15:01:35

integrated custom (iOS/Android) native modules

dnolen15:01:42

run advanced compilation and not written a single extern

👍 3
Alexis Vincent15:01:05

Personally, I’d love to see really seamless requires between cljs and js. cljs from js and js from cljs. Is this something we might end up with?

dnolen15:01:28

the only issue is that Krell is a little rough around the edges still and hopefully can work on that

dnolen15:01:30

cljs <-> js is really problematic because JS modules and ClojureScript namespaces are fundamentally different

Alexis Vincent15:01:36

I’ve also wondered about esm and leveraving tools such as rollup

dnolen15:01:43

and both require build tools

dnolen15:01:20

and ClojureScript needs it to work at the REPL which really JS users don't care about - precise hot-reloading is not really a thing post-ES6 modules

dnolen15:01:15

I've thought about it a lot in the past but I think it's not worth the effort, but won't get in the way if someone comes w/ a good plan and patches

Alexis Vincent15:01:39

How critical is the Closure compiler to cljs future given static analysis tools in js land?

dnolen15:01:08

the static analysis tools in JS land still aren't that good was my impression every time I check

dnolen15:01:33

Closure is still state of the art

Alexis Vincent15:01:07

IS there any place for a 2 step process. cljs compile to Closure friendly but js native output, with optional closure optimisation as part of standard build tooling in a js world

dnolen15:01:00

also Google is using more ES6 / TypeScript so perhaps Closure will make this stuff easier ...

dnolen15:01:10

it's already a 2 step process

Alexis Vincent15:01:14

Or is this at odds with compile chain? I’m not too clued up

dnolen15:01:36

the problem is if you want a JavaScript files to depend on a ClojureScript file

dnolen15:01:40

the other way is easy

Alexis Vincent15:01:31

Is there some literature out there about issues with that direction?

dnolen15:01:14

I think nothing substantial

Alexis Vincent15:01:30

Other then maybe dynamic ns declarations or late defs, doesnt a namespace look a lot like a module?

dnolen15:01:30

yes, but the "other then maybe" is a big one

dnolen15:01:59

ES6 modules are like closures you can't get at them - ClojureScript namespaces are global objects and redefinition is trivial

dnolen15:01:39

most of the reason you're using a Lisp is redefinition

dnolen15:01:25

Racket works like this (which is where ES6 modules came from), and I really don't like it

dnolen15:01:49

there's a lot of things that we do at work like REPL into a running service or a running device and do some surgical change

dnolen15:01:01

that opaque modules close the door to

Alexis Vincent15:01:29

Fair. Static esm exports would be an issue for compile time optimisation maybe, But why would exporting a dynamic namespace as default esm export not be suitable?

dnolen15:01:15

that is an interesting bridging idea

Alexis Vincent15:01:18

so importing from a cljs namespace gives you a live blob

Alexis Vincent15:01:10

and then having a second path like cljsRequire(“x.y.m”) for live stuff

dnolen15:01:21

but I think there's lot of annoying details / non-obvious problems here

dnolen15:01:01

but I think there's also enough stuff in ClojureScript right now to just try it

Alexis Vincent15:01:12

^ fair, I guess I just dont have a good idea about how the compiler works. But I’ll check it out!

dnolen15:01:24

is a good intro

Alexis Vincent15:01:45

I’m starting to build more into nodejs and I want to be able to integrate more natively into the ecosystem. npm publish cljs libs etc. Have people on the team writing in TS.

Alexis Vincent15:01:20

Thanks! Will look into that.

Alexis Vincent15:01:02

Not just node, but browser as well. Really feel like theres untapped value in those ecosystems, that we’re missing out on in clj(s) land

Alexis Vincent15:01:05

:bundle and shadow-cljs go a long way to bridging the gap. But theres always work to be done

dnolen15:01:29

there's a big maybe there

Alexis Vincent15:01:41

@dnolen Another idea re js<-cljs could be a default as suggested above, but when static defs are expected, a ns metadata tag could suggest static esm exports rather then the live default thing

dnolen15:01:44

using JS is not that bad anymore IMO, could be improved a little

dnolen15:01:57

the other problem w/ using CLJS from JS is how meaningful is it

dnolen15:01:11

those fns will be bridging stuff

dnolen15:01:17

because of the data exchange problem

dnolen15:01:46

ClojureScript data structures are not arrays and not objects

dnolen15:01:01

and fns that can be called from JS must marshal to EDN to be idiomatic

dnolen15:01:16

so this won't be core fns, only bridging fns

Alexis Vincent15:01:52

Fair, but I think using cljs as a lib language can offer a bunch. I expose a cljs stuff to TS engineers in Kepler 16, and often they’re manipulating cljs data-structures from TS (they’re just opaque lib datastructures)

Alexis Vincent15:01:16

I’d also love to be able to easily publish cljs libs that expose js interfaces

Alexis Vincent15:01:32

And have that work in downstream compiler chains

Alexis Vincent15:01:01

Without bundling cljs every time.

Alexis Vincent15:01:40

Considering cljs lang as an npm lib that is simply required,

Alexis Vincent15:01:47

So that cljs libs can use js libs that use cljs libs. And then someone wants to ship that to the browser and so they compile and optimise it downstream somewhere

Alexis Vincent15:01:01

Like what happens in js world

dnolen15:01:32

one wacky idea would be to write a tool that just takes ClojureScript and converts it into a series of ES6 modules and you publish that

dnolen15:01:38

I'd be curious to see what problems you run into

dnolen15:01:54

this could probably be done w/ compiler passes as I said above

Alexis Vincent15:01:36

I could also imagine publishing clojurescript as a library to npm

dnolen15:01:02

yes that would be the point

Alexis Vincent15:01:32

I misunderstood what you meant. But thats exactly it

dnolen15:01:15

happy to see someone try that and help tweak whatever needs to be done to support that

dnolen15:01:46

would also be interesting as it would allow better measurements between Closure and other JS tooling for ClojureScript specifically

Alexis Vincent16:01:03

I’d support the same. Potentially financially, or time this year. Going to be building out more clj/cljs infrastructure this year for Kepler 16. Would be glad to have some of that feed back into the broader ecosystem

Alexis Vincent16:01:02

My own time is limited. But might get some time to play

Alexis Vincent16:01:43

I’m looking to hire someone full time into infrastructure mid 2021. Happy to commit some time to this effort

Alexis Vincent16:01:23

Good to know we would have some of your support

dnolen16:01:42

happy to help make things possible

namenu16:01:58

I'm wondering why aclone is coping elements with dotimes? Isn't Array.slice much faster? https://github.com/clojure/clojurescript/blob/r1.10.773-2-g946348da/src/main/cljs/cljs/core.cljs#L432

dnolen16:01:30

@namenu historically, no - not consistently across every JS engine

dnolen16:01:11

we haven't measured recently should do that

Alexis Vincent16:01:24

@dnolen Thanks for the video. Good intro

clyfe20:01:53

Cont'd from https://ask.clojure.org/index.php/9949/macro-that-uses-cljs-async-and-clojure-async-how-to, cljs needs a designated, no-hack, future-proof way to answer compiling-cljs? when compiling clj for cljs use.

clyfe20:01:16

Some sort of reader conditionals on macro time.

dnolen20:01:15

@claudius.nicolae probably we could add something to env map, every macro gets that

dnolen20:01:40

that said, very little in the analyzer has changed in a long time and I don't expect it to

clyfe21:01:28

@dnolen Although I put it in this room, my view is that it's something clojure (as a language) should do - expand the reader conditionals to work in clj macros somehow (not necessarily that, but the point is made).

clyfe21:01:04

Folks already use most often (:ns &env) presence as a flag (which could potentially be breaking in the future)

dnolen23:01:29

We can make a ClojureScript specific key to avoid the case where Clojure might use :ns, I don’t see anything else happening