Fork me on GitHub
#clojurescript
<
2022-09-29
>
Benjamin12:09:55

do you think it makes sense to advance compile for an electron app?

pesterhazy13:09:04

I don't think we advance compile the node part of our electron app, but we do advance compile the browser part

pesterhazy13:09:57

Just checked, we use :simple for the node process, :advanced for the browser process

pesterhazy13:09:56

As for reasons, bundle size is not as important for a .dmg file, which is anyway 50M+ because you're shipping an entire Chromium browser etc

Benjamin13:09:43

that is interesting, thanks

thheller19:09:25

:advanced is less code, so it does improve startup time a little bit even if no network is involved

👀 1
Kelvin13:09:06

What JS/CLJS libraries do people use/recommend for tries? I’d imagine that such libs would be commonly used, e.g. for text searches.

Lone Ranger16:09:34

Mutable or immutable tries? A lot of the persistent collections are built on tries under the hood. You mean like some of those fancy suffix tree string search data structures?

Lone Ranger16:09:40

Not sure if it fits your usecase, but clojure.data.avl, and tonsky's persistent-sorted-set are pretty cool, depending on what you are looking for. https://github.com/tonsky/persistent-sorted-set, https://github.com/clojure/data.avl, provided you are looking for immutable offerings.

shaunlebron19:09:44

Is this the best way to get a ^js ~ctx type hint inside a macro? I had to use ^{:tag ~'js} to prevent namespace-qualification:

`^js/React.Element ($ (.-Provider ^{:tag ~'js} ~ctx) …)

p-himik19:09:06

If other things don't work, you can probably use ^js/Object.

shaunlebron19:09:23

ah, of course! ty

thheller19:09:40

note that it is almost always better to create a helper function that handles the tag, than doing the tagging in the macro

thheller19:09:10

(defn get-provider [^js ctx] (.-Provider ctx)) in use (get-provider ~ctx) in the macro

thheller19:09:29

:advanced will cause it to be inlined most likely anyways so there isn't even any code difference

thheller19:09:46

and imho its much easier to read and understand the related macro code

thheller19:09:45

also often actually generates much less code

thheller19:09:37

also in the above the $ (which I assume is a macro) could handle the tagging, so having the ^js/React.Element is not actually needed if it did

shaunlebron19:09:42

this is the issue I’m trying to fix: https://github.com/lilactown/helix/pull/104

thheller20:09:19

helper function seems best

shaunlebron20:09:45

also, technically I think ^js would put externs on Object whereas ^js/Object would put externs on Object.prototype. Does that matter?

shaunlebron20:09:19

maybe that difference wasn’t actually intended, but it’s there

Lone Ranger20:09:49

Is there some documentation somewhere on the relationship between tags and externs..?

Lone Ranger23:09:46

Word, thanks!