Fork me on GitHub
#qa2019-05-31
>
john14:05:39

The only thing that confuses me is I can't tell if the missing j refers to the :keys vector or to the structure of the map on the right.

borkdude14:05:36

the :keys vector

john14:05:40

And the fact that i is a :i in the :keys vector is a keyword adds a little confusion for me.

john14:05:25

Huh, I didn't know you could put keywords in there

john14:05:50

Well, in that case, it makes more sense

borkdude14:05:51

I was hoping the word destructured would make it clear it was about the :keys vector

john14:05:50

Yeah, I guess I was only thrown off by the :i in keys. I usually do :keys [i] ...

john14:05:29

So I was expecting i to throw that error before j

borkdude14:05:58

@john you can even put namespaced keywords there, so:

(let [{:keys [:person/name]} {:person/name "Rich"}] name)

john14:05:32

yeah, interesting :thinking_face:

borkdude14:05:36

or:

(let [{:person/keys [name address]} #:person{:name "Rich" :address "Some city"}] [name address])
["Rich" "Some city"]

john14:05:21

oh, I like that... can you have multiple :some-ns/keys instances?

john14:05:43

I like that better than having to destructure namespaced keys key by key

john14:05:12

So to answer your question, given that knowledge, I say the error message makes sense

borkdude16:05:19

@stefan.van.den.oord thanks for the feedback. where is this syntax for CLJS documented? (:require ["react-native-view-overflow" :default ViewOverflow])

Stefan16:05:08

First line in table 1

borkdude16:05:23

oh shadow-cljs

Stefan16:05:50

:the_horns:

borkdude16:05:50

how are you using this default? is that like an alias?

Stefan16:05:13

It’s the equivalent of this in JS: import defaultExport from "module-name"

Stefan16:05:37

Some 3d party modules export their stuff as default, which is considered old fashioned, but what can you do 😕

borkdude16:05:40

let me ask the question another way: how can clj-kondo know that you are using the namespace 🙂

Stefan16:05:00

By detecting that I’m using the ViewOverflow thing.

borkdude16:05:10

ok, so it’s like :refer in that regard

Stefan16:05:17

e.g. [:> ViewOverflow ... ]

Stefan16:05:24

Yeah I guess…

borkdude16:05:31

ok, I’ll make a different issue for this

Stefan16:05:08

While you’re at it, you may have a look at the other constructs in that table, e.g. :rename, if you don’t support that yet…

borkdude16:05:32

:rename is standard Clojure, that’s already supported

Stefan16:05:37

oh ok 🙂

Stefan16:05:14

Soooo many ways to do things in JS, you gotta love it 😉

borkdude16:05:01

I wonder why shadow-cljs adds a different thing instead of :refer though

borkdude16:05:14

you can just use refer I guess?

borkdude16:05:16

I’ll ask in #clojurescript

Stefan16:05:06

or ask in #shadow-cljs

borkdude16:05:48

does your code still work when you use :refer? because then my suggestion would be to just use that and not introduce deviations from standard CLJS

Stefan16:05:25

No, that doesn’t seem to work…