Fork me on GitHub
#clojurescript
<
2019-03-01
>
idiomancy01:03:55

is it still the case that core.async go blocks have the potential to leak memory and so should be used sparingly? Id really like to be able to just map a set of functions such that they all pass to each other over channel interface, but if sparing use of async functions is recommended, then I would optimize along putting more transformations into a single function

idiomancy02:03:45

better question. once you put channels on channels WHY is it so hard to get things back to a channel of values??

Alex Miller (Clojure team)02:03:01

I think the memory thing was fixed in one of the last rounds of updates?

idiomancy02:03:19

outstanding. time to abuse channels

aisamu03:03:14

Hi! Is this expected? nil as a value is "null", but as a key is "nil"

(->> {:nvalue nil, nil "nkey"}
     clj->js)
;; prn => #js {:nvalue nil, :nil "nkey"}
;; console.log => {nvalue: null, nil: "nkey"}

souenzzo04:03:32

null value is not a valid key to js object. clj->js turns it into "nil" string.

aisamu04:03:49

Sure, but why not the "null" string? Then JS's usual coercion would be enough:

const m = {null: "nkey",
           undefined: "ukey"};
console.log(m);
console.log(m.undefined);
console.log(m.null);
The above "works" as expected (with keys being converted to strings)

souenzzo11:03:54

It should use str by default, but sure it's not a planned behavior

Jakub Holý (HolyJak)15:03:40

I wonder, is there a good cljs alternative to Gatsby (data fetch & transform > graphql > static React site)? Thanks!

khardenstine15:03:32

any transit pros know if I’d doing something wrong with custom tagged values? I’m thinking i stumbled on a bug with the :json reader https://gist.github.com/khardenstine/557fcaa221f51c48d2b1ff6bbfc102cb

souenzzo18:03:56

How to do it in cljs?

class Foo {
  static bar = {x: 42}
}
myFoo = new Foo()
external_call(myFoo)
(i need to pass a object do external_call that "implements" that static bar )

thheller18:03:57

(deftype Foo []) (goog.object/set Foo "bar" #js {:x 42}) should work

👍 10
thheller18:03:49

this is a bit tricky with closure :advanced and may need tweaks

souenzzo18:03:09

Ok. the lib will just myFoo.bar and expect to receive {x: 42}

thheller18:03:50

hmm that may not actually work then. thought it was using the class Foo directly not just the instance

john19:03:59

new thing for npm packages that claims to bring some clarity to the mess https://github.com/pikapkg/web <- @thheller

thheller19:03:03

hmm interesting. don't think that its actually a good idea though.

john19:03:59

in general, or from a cljs perspective?

thheller19:03:03

the "Performance" section is a bit naive

john19:03:33

seems to be centered around optimizing HTTP/2

thheller19:03:12

yeah but it still discounts DCE completely

john19:03:27

Uses rollup under the hood

thheller19:03:40

yeah but it seems to only use it for npm deps. not project code. so it can't possibly tell what is going to be used and what not.

thheller19:03:23

so "big" packages like antd or @material-ui/core will just still import everything I guess?

thheller19:03:35

also there a plenty of packages that don't have a module entry in package.json. eg. react

john19:03:53

It might pull in deps lazily, ala Rollup's "Live Code Inclusion"?

john19:03:07

LCI being an alternative strategy to DCE

john19:03:35

Interesting how they mention that Rollup was partly inspired by @dnolen

john19:03:17

I guess GCC's version of LCI is the module loader system. We just don't used it enough...

thheller20:03:37

:modules are definitely not used enough yes

jaide20:03:57

Hah thanks, I guess it’s not listed in the archive for whatever reason.

thheller20:03:20

Listed under a different title: January 6, 2015 » JavaScript Modularity Shaming

jaide20:03:10

Damn you’re good!

thheller20:03:29

well the hint was in the .md you just posted 😉

thheller20:03:49

> title: "JavaScript Modularity Shaming"

thheller20:03:46

that is a jekyll setup, I use a similar setup in my blog so it is familiar 😉

jaide20:03:29

Oh cool, can you share the link? I used perun for mine, not super familiar with jekyll though I see the issue. The link from the github repo has a trailing slash which was causing the not-found page. 😈 in the details