This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-19
Channels
- # announcements (9)
- # babashka (5)
- # babashka-sci-dev (23)
- # beginners (160)
- # calva (78)
- # cider (23)
- # clj-commons (2)
- # clj-kondo (5)
- # cljdoc (19)
- # cljs-dev (8)
- # clojure (54)
- # clojure-australia (1)
- # clojure-czech (2)
- # clojure-dev (17)
- # clojure-europe (8)
- # clojure-italy (8)
- # clojure-nl (2)
- # clojure-sg (3)
- # clojure-uk (4)
- # clojurescript (70)
- # community-development (8)
- # core-async (8)
- # cursive (7)
- # datahike (12)
- # datalog (22)
- # datomic (20)
- # events (1)
- # fulcro (43)
- # graalvm (92)
- # gratitude (5)
- # holy-lambda (77)
- # honeysql (1)
- # jobs (1)
- # lsp (111)
- # membrane (70)
- # nextjournal (13)
- # off-topic (73)
- # pathom (1)
- # polylith (8)
- # portal (32)
- # re-frame (3)
- # reagent (4)
- # reitit (5)
- # releases (2)
- # reveal (4)
- # xtdb (22)
I don't think it allows anything new, can you explain?
:as-alias
doesn't load the namespace, it only ensure the existence of the ns object in the clojure runtime. so it won't trigger a circular loading of namespaces.
(ns a (:require [b :as-alias b])) (prn ::b/ok)
(ns b (:require [a :as-alias a])) (prn ::a/ok)
:as-alias
is based on create-ns
and create-ns does nothing if the namespace exists. this is why it works out ok
One last question: I can say that this is a feature? Or it works by a implementation detail and may not be supported in the future (or not ported to cljs/other targets)?!
I'd say it's not even a feature - there is no loading happening so it's not allowing anything new in that respect
how or whether it will work in CLJS is a question for @dnolen
@souenzzo a fun implementation detail. there is a var in clj called *loaded-libs*
. at the and of the ns
form this is conj-ed on to. After that another require of that ns won't trigger any loading. But this is handled separately from creating namespaces with create-ns
, it's an extra thing for a ns to be considered already loaded
thinking about it briefly it can probably work for ClojureScript, yes - none of reified ns stuff I think is needed
yeah, it's probably easier in CLJS, it's just name resolution really