This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-25
Channels
- # announcements (3)
- # aws (6)
- # beginners (143)
- # boot (14)
- # calva (2)
- # cider (1)
- # clara (1)
- # clj-kondo (1)
- # cljdoc (4)
- # cljs-dev (50)
- # cljsrn (5)
- # clojure (61)
- # clojure-chicago (1)
- # clojure-europe (4)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-spec (32)
- # clojure-uk (11)
- # clojurescript (166)
- # clojureverse-ops (2)
- # clr (3)
- # core-typed (1)
- # cursive (8)
- # datomic (21)
- # defnpodcast (1)
- # emacs (1)
- # figwheel (1)
- # figwheel-main (1)
- # fulcro (7)
- # graphql (7)
- # jobs (8)
- # leiningen (4)
- # luminus (3)
- # lumo (17)
- # mount (3)
- # nrepl (4)
- # off-topic (113)
- # pedestal (1)
- # re-frame (15)
- # reagent (2)
- # reitit (2)
- # shadow-cljs (75)
- # spacemacs (3)
- # sql (12)
- # tools-deps (44)
- # uncomplicate (2)
- # xtdb (15)
Is it expected that compiler’s env doesn’t include an anonymous function in :fn-scope
?
Here :fn-scope
is only going to have fn-1
(defn fn-1 []
(fn [a]
a))
@roman01la concrete example (fn console [] ...)
fwiw it's sometimes useful to use the git history to see what test was associated w/ a change - the test hopefully makes it clear what was broken
to clarify further, we use each entry in :fn-scope
to produce a qualified name that can be used for recursion
I’m trying to detect if a local var is an argument of the top most function, not sure what’s the general algorithm here?
we could of course generate random names - but the above has the added benefit of aligning w/ something you see in Clojure as well as helping w/ debugging
@roman01la I wouldn't mess w/ any of this
yes, that’s what I’m doing
Ok, perhaps I missed something, I have to look more into it. I’ll get back if I need more help. Thanks!
as you walk down the AST w/ the original fns args, just check to see if you got shadowed via a new binding or fn arg
is it normal to get errors when using ^boolean
type hints in cljc code? eg
Error in phase :compile-syntax-check
IllegalArgumentException: Unable to resolve classname: clojure.core$boolean@6fc1e52d
I don’t get an error if I type something like (defn ^boolean x [])
in a clojure repl
@mhuebert the return value tag is placed incorrectly. so likely it just isn't interpreted? this fails
(defn x ^boolean [])
CompilerException java.lang.IllegalArgumentException: Only long and double primitives are supported,
k, for some history ^boolean
was introduced when we started to doing persistent datastructures
@mhuebert It is also possible in many cases for the compiler to infer that a function returns a Boolean value. This depends on the body of the function.
I think I considered a flag for :warn-on-cljs-truth
but I think that was before file-scoped dynamic vars
(Sorry about the goog-define
noise in my previous comment; thought that was the code in question.)
ok. After using the analyzer to do a bit of digging, hints were propagating up from function bodies more than I realized
right a lot code users write isn't higher-order (this isn't Haskell afterall), so the surface area that our simple inference covers is surprisingly effective
but we can't do too much about partial
, comp
, apply
etc. right now - but I think not really a big deal, and those things would require a lot more effort
Hello cljs-dev! I am interested in seeing this one addressed: https://dev.clojure.org/jira/browse/CLJS-3074 - do you think it would be a good first issue for me to tackle?
doesn't require getting too deep into compiler know-how - but enough to get familiar with the process
make sure to read over this https://clojurescript.org/community/contributing