This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-29
Channels
- # babashka (4)
- # babashka-sci-dev (96)
- # beginners (79)
- # calva (26)
- # cider (5)
- # clerk (2)
- # clj-kondo (23)
- # clojars (14)
- # clojure (54)
- # clojure-europe (8)
- # clojure-sweden (3)
- # clojurescript (76)
- # datomic (12)
- # deps-new (6)
- # emacs (20)
- # events (3)
- # exercism (1)
- # fulcro (11)
- # funcool (12)
- # hugsql (14)
- # hyperfiddle (6)
- # kaocha (1)
- # lambdaisland (1)
- # lsp (22)
- # malli (1)
- # matcher-combinators (6)
- # nbb (6)
- # off-topic (128)
- # polylith (14)
- # re-frame (4)
- # reagent (1)
- # releases (4)
- # shadow-cljs (8)
- # tools-build (13)
- # tools-deps (13)
- # tree-sitter (5)
Seems RCF messes up with the &env
of macros?
{i {:op :binding, :name i, :init {:op :invoke, :form (. clojure.lang.Numbers clojure.core/long_array 1 0), :env {:locals {}, :namespaces {}, :ns com.xadecimal.procedural}, :fn {:op :symbol, :local? false, :env {:locals {}, :namespaces {}, :ns com.xadecimal.procedural}, :form ., :ns nil, :name .}, :args [{:op :symbol, :local? false, :env {:locals {}, :namespaces {}, :ns com.xadecimal.procedural}, :form clojure.lang.Numbers, :ns nil, :name clojure.lang.Numbers} {:op :symbol, :local? false, :env {:locals {}, :namespaces {}, :ns com.xadecimal.procedural}, :form clojure.core/long_array, :ns clojure.core, :name long_array} {:op :const, :env {:locals {}, :namespaces {}, :ns com.xadecimal.procedural}, :form 1} {:op :const, :env {:locals {}, :namespaces {}, :ns com.xadecimal.procedural}, :form 0}], :children [:fn :args]}, :form i, :local :let, :children [:init]}}
I have a macro that uses &env, and I can't test it using RCF, because the macro no longer receives normal LocalBindings.RCF has its own analyzer, env and macroexpander. However, a userland macro should be called with a regular &env value. I'll create an issue.
@U0K064KQV can I see your macro? I am considering possible solutions and want to understand better the pattern
It's a non trivial macro. What I do is that I attach metadata to locals I create in one pass. And use the &env to inspect that metadata on another pass. I use that metadata to learn about the type hints and also to distinguish the locals my macro created versus the ones the user created.