Fork me on GitHub

Is there a way to get cljsjs function resolution to work? For things like (.useState js/React 0) it is saying that .useState cannot be resolved.


Not at the moment sorry, but I鈥檓 planning improvements in this area.

馃憤 3

I did realize that changing it to (js/React.useState 0) doesn't throw the false positive


But (js/document.getElementById ...) does throw the false positive


minor thing - dotted aliases get a warning when defining a REPL using deps.edn - it works but it's a bit confusing



Alex Miller (Clojure team)14:03:07

aliases are keywords and according to the reader, "They cannot contain '.' in the name part, or name classes."


What exactly does 'name classes' mean in that sentence?


I'm probably missing something obvious


as in they should not match the name of a class?

Alex Miller (Clojure team)14:03:45

reduce and java.lang.String are both symbols but follow different paths in resolution so class names are special cases. I assume keywords disallow class names for some place where this collides, but I don't actually know where. iow, I'm not totally sure why this restriction exists.


I see, TIL 馃檪 I still wonder why the doubling down there matters. If a keyword doesn't contain a period, it cannot be a class name either?

Alex Miller (Clojure team)14:03:51

I guess you'd be more likely to run into a problem with destructuring keyword to symbol (let [{:keys [java.lang.String]} m] ...)

Alex Miller (Clojure team)14:03:31

the period restriction I think is primarily intended to push hierarchical naming to namespaces, not in names

馃榾 3

That's a good point re :keys. On that note, which one is more idiomatic, :keys [foo] or :keys [:foo]?


馃憤:skin-tone-3: thank you Alex

Alex Miller (Clojure team)14:03:58

keywords were primarily (only?) allowed in :keys originally to support autoresolved keyword resolution

Alex Miller (Clojure team)14:03:43

using ::keys or ::alias/keys etc is now preferred

Alex Miller (Clojure team)14:03:30

so I think that's actually a correct warning

Alex Miller (Clojure team)14:03:23

@dnolen some reason you're not using namespaced aliases instead? :my/alias instead of :my.alias ?


hrm ok, I don't think I realized that dot was restricted to the namespace part

Alex Miller (Clojure team)14:03:19

not sure that's actually enforced anywhere


I also recently learned about that restriction. Honestly I think a lot of people are just using this without knowing this restriction. Tracking an issue about that here:

Jakub Hol媒 (HolyJak)21:03:05

Hi @cfleming! What is the status of support for navigating to keywords? Mr. @smith.adriane is using namespaced keywords in #membrane for (i.e. an intent is [::some-kwd] and there is (defeffect :the.ns/some-kwd ...) ) is it possible to jump from the former to the latter? is/will there be a general support for that or does Cursive require per-framework extension? Thank you!!!


It looks like might have an answer. It seems like you can tell cursive how to resolve a symbol for a given macro. There's already built in support for the re-frame macros, I wonder if membrane could piggyback on one of those.


Yes, I think so. I think resolving them as one of the re-frame forms should work. I think I鈥檒l also add a generic keyword def that can be used for this purpose, since the re-frame ones will also affect the icon that鈥檚 shown in the structure view etc.

馃帀 6
鉂わ笍 3