Fork me on GitHub
#shadow-cljs
<
2019-04-18
>
flyboarder02:04:02

5 | (defmethod h/do! ::/grid -------------------------------^------------------------------------------------ uikit_hl/grid.cljs [line 5, col 25] Invalid keyword: ::/grid. -------------------------------------------------------------------------------- Any ideas channel?

flyboarder02:04:19

nvm, that is a perfect error and I clearly dont know how to use keywords XD

flyboarder02:04:33

correct kw is ::grid

flyboarder03:04:53

Hmm, it would seem any namespaced keyword throws this error, including ::ns/my-name and :my.ns/my-name

lilactown03:04:13

the first one I would expect, the second I would not

flyboarder03:04:54

@lilactown those are both valid namespaced keywords

lilactown03:04:09

only if ns is aliased to something

flyboarder03:04:19

either way shadow throws

flyboarder04:04:14

As a note im on 2.8.14

flyboarder04:04:21

oddly :my-ns/my-name works

thheller07:04:24

@flyboarder ::/grid is not a valid keyword. ::ns/my-name is valid if you have a (:require [some.thing :as ns]) otherwise it is not. :my.ns/my-name is always valid.

thheller07:04:03

::grid is always always dependend on ns, so (ns foo.bar) ::grid makes :foo.bar/grid

flyboarder14:04:43

@thheller in 2.8.14 ::ns/grid and :my.ns/grid both throw invalid keyword errors

flyboarder14:04:28

Where :my-ns/grid works fine, seems it doesn’t like dots or auto resolving

flyboarder14:04:33

Specifically I wanted to use the first case, where I have my namespace aliased, however when that failed I tried using the fully qualified namespace which is also failing.

thheller16:04:21

@flyboarder :my.ns/grid throws? that sounds questionable?

flyboarder16:04:47

@thheller yes, I assumed it should work

flyboarder16:04:59

Also the aliasing throws as well

thheller16:04:49

can you please show the actual error because I find this quite unbelievable

flyboarder16:04:58

Sure one sec

thheller16:04:40

I can't even remember when namespaced keywords were added. so I doubt there is even a tools.reader version that didn't support it, ruling out dependency conflicts?

flyboarder16:04:51

@thheller here it is with fully qualified name

flyboarder16:04:57

39 |   (grid/grid :match true :uikit-hl.width/1-1-s true :uikit/width-1-1-s true :uikit/child-width-1-1-s true :uikit/child-width-1-3-m true; :class [:uk-grid-collapse]
-----------------------------------------------------^--------------------------
app/ui.cljs [line 39, col 47] Invalid keyword: :uikit-hl.width/1-1-s.

--------------------------------------------------------------------------------

thheller16:04:35

well that its a different story. keywords cannot start with a number so :uikit-hl.width/1-1-s is invalid because of that

thheller16:04:00

nothing to do with the ns

flyboarder16:04:01

@thheller is that a cljs thing? it works in a clojure repl

flyboarder16:04:47

ah it seems (keyword 1) returns nil

flyboarder16:04:58

but ::2 works

dpsutton16:04:58

user> :a/1
RuntimeException Invalid token: :a/1  clojure.lang.Util.runtimeException (Util.java:221)

cljs.user> :a/1

clojure.lang.ExceptionInfo: [line 1, col 5] Invalid keyword: :a/1. {:type :reader-exception, :ex-kind :reader-error, :file nil, :line 1, :col 5}

thheller16:04:09

> Symbols begin with a non-numeric character and can contain alphanumeric characters

thheller16:04:19

> Keywords follow the rules of symbols, except they can (and must) begin with :

flyboarder16:04:53

and yet this works :2

dpsutton16:04:15

i think this comes up a little. the reader accepts a bit more than the spec says

thheller16:04:31

yeah the reader isn't as strict as it should be sometimes

dpsutton16:04:41

but they are invalid and can break in future versions

thheller16:04:41

I think that is only for historic reasons though

flyboarder16:04:10

ok so I really need to rethink the naming of these keywords

flyboarder16:04:25

thanks everyone - I just learned so much in the past 5 minutes

flyboarder16:04:18

really nice to know that shadow correctly detected this problem, I just didn’t know enough to resolve it

thheller16:04:54

thats not shadow recognizing it. thats tools.reader so you'd get that error anywhere