encore
encore copied to clipboard
defalias doesn't work as expected in ClojureScript
Reproduction steps:
$ clj -Sdeps '{:deps {com.taoensso/encore {:mvn/version "3.9.2"}}}' -m cljs.main --repl-env node
WARNING: When invoking clojure.main, use -M
ClojureScript 1.10.339
cljs.user=> (require '[taoensso.encore :refer [defalias]])
nil
cljs.user=> (defalias foo map)
#'cljs.user/foo
cljs.user=> (meta #'foo)
{:ns cljs.user, :name foo, :file "<cljs repl>", :end-column 14, :source "foo", :column 1, :line 1, :end-line 1, :arglists (), :doc nil, :test nil}
The docstring metadata from #map
was not attached to #'foo
Hi Yehonathan,
Thanks for the report. It's not immediately obvious to me what the issue could be, could you please also include your output for (meta #'map)
?
Thanks!
Just pushed [com.taoensso/encore "3.9.3-alpha1"]
to Clojars- would you please also try that and let me know if it solves the issue? Thanks!
@ptaoussanis Issue still there
👍 Could you please also include your output for (meta #'map)
?
Here is the full output:
clj -Sdeps '{:deps {com.taoensso/encore {:mvn/version "3.9.3-alpha1"}}}' -m cljs.main --repl-env node [12:00:50]
DEPRECATED: Libs must be qualified, change tubular => tubular/tubular (/Users/viebel/.clojure/deps.edn)
Downloading: com/taoensso/encore/3.9.3-alpha1/encore-3.9.3-alpha1.pom from clojars
Downloading: com/taoensso/encore/3.9.3-alpha1/encore-3.9.3-alpha1.jar from clojars
WARNING: When invoking clojure.main, use -M
ClojureScript 1.10.339
cljs.user=> (require '[taoensso.encore :refer [defalias]])
nil
cljs.user=>(defalias foo map)
#'cljs.user/foo
cljs.user=> (meta #'foo)
{:ns cljs.user, :name foo, :file "<cljs repl>", :end-column 14, :source "foo", :column 1, :line 1, :end-line 1, :arglists (), :doc nil, :test nil}
cljs.user=> (meta #'map)
{:ns cljs.core, :name map, :file "cljs/core.cljs", :end-column 10, :top-fn {:variadic true, :max-fixed-arity 4, :method-params ([f] [f coll] [f c1 c2] [f c1 c2 c3]), :arglists ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]), :arglists-meta (nil nil nil nil nil)}, :column 1, :line 4654, :end-line 4654, :arglists ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]), :doc "Returns a lazy sequence consisting of the result of applying f to\n the set of first items of each coll, followed by applying f to the\n set of second items in each coll, until any one of the colls is\n exhausted. Any remaining items in other colls are ignored. Function\n f should accept number-of-colls arguments. Returns a transducer when\n no collection is provided.", :test nil}
cljs.user=>
Just pushed [com.taoensso/encore "3.10.1"]
which should address this, with some limitations:
- Cljs macros can't be aliased.
- For Cljs docstring to work, the provided source must be fully qualified.
I still cannot make it work
clj -Sdeps '{:deps {com.taoensso/encore {:mvn/version "3.10.1"}}}' -m cljs.main --repl-env node [17:58:10]
DEPRECATED: Libs must be qualified, change tubular => tubular/tubular (/Users/viebel/.clojure/deps.edn)
Downloading: com/taoensso/encore/3.10.1/encore-3.10.1.pom from clojars
Downloading: com/taoensso/encore/3.10.1/encore-3.10.1.jar from clojars
WARNING: When invoking clojure.main, use -M
ClojureScript 1.10.339
cljs.user=> (require '[taoensso.encore :refer [defalias]])
nil
cljs.user=> cljs.user=> (defalias foo cljs.core/map)
#'cljs.user/foo
cljs.user=> (meta #'foo)
{:arglists (), :file "<cljs repl>", :ns cljs.user, :doc nil, :line 1, :column 1, :name foo, :test nil}
Hi there! Okay, will re-open and try look at this more closely next time I have an opportunity for some open source.
3.10.1
works okay for me, but I'm not using clj
- and couldn't get your command there to successfully run locally for some reason. (I don't use clj
, so not too familiar with it).
I guess that this might specifically be a REPL issue - but will try dig more.
Docstrings should now be properly retained in Cljs with [com.taoensso/encore "3.38.0"]
👍