This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-23
Channels
- # aws-lambda (5)
- # beginners (212)
- # boot (3)
- # cider (130)
- # cljs-dev (24)
- # clojars (2)
- # clojure (287)
- # clojure-dusseldorf (23)
- # clojure-italy (11)
- # clojure-russia (10)
- # clojure-spec (9)
- # clojure-uk (45)
- # clojurescript (59)
- # core-async (1)
- # cursive (13)
- # datascript (1)
- # datomic (46)
- # emacs (12)
- # events (9)
- # fulcro (196)
- # graphql (3)
- # hoplon (79)
- # jobs (5)
- # jobs-discuss (7)
- # jobs-rus (2)
- # keechma (26)
- # keyboards (9)
- # leiningen (2)
- # luminus (9)
- # off-topic (20)
- # om-next (1)
- # onyx (15)
- # re-frame (16)
- # reagent (18)
- # reitit (1)
- # remote-jobs (2)
- # rum (3)
- # shadow-cljs (13)
- # sql (135)
- # unrepl (46)
- # vim (1)
- # yada (23)
making (defn foo ^boolean [] ..)
work in cljs and soft deprecating (defn ^boolean foo [] ..)
so I don’t know about deprecating, I guess the former thing should at least be made to correctly propagate type info
these have different meanings(whether you’re type-hinting the var or the return type of the function) and different behavior (var meta are eval’ed, the signature meta is not). Generally type-hinting the return type (before the args vector) is the recommended and preferred place in Clojure.
In the AST, for (defn ^boolean foo [] ..)
we end up with both :ret-tag boolean
and :tag boolean
.
Perhaps these could somehow be detangled so that (defn foo ^boolean [] ..)
affects :ret-tag
…
@alexmiller one difference here is that var meta is never eval’ed
also (defn foo ^boolean [] ...)
in clj will throw anyway. we'd be matching style but not substance
@favila Interesting point about multiple arities. It reminds me that the patch in https://dev.clojure.org/jira/browse/CLJS-1997 doesn't handle that case.
actually I guess there are in theory six possible things to check: arity tag, arity ret-tag, fn tag and ret-tag, and var tag and ret-tag.
Yeah, there is some interesting fallback logic here already: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L1543-L1545