This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # babashka (12)
- # beginners (15)
- # biff (2)
- # calva (17)
- # clj-kondo (19)
- # clj-on-windows (3)
- # clj-otel (1)
- # clojure (3)
- # clojure-europe (5)
- # conjure (2)
- # graalvm (2)
- # helix (5)
- # introduce-yourself (1)
- # nbb (24)
- # off-topic (32)
- # polylith (3)
- # reitit (21)
- # releases (1)
- # reveal (3)
- # scittle (1)
- # squint (56)
- # tools-deps (4)
- # xtdb (6)
I need input on how https://github.com/polyfy/polylith/issues/247 should be approached. TL;DR: the recently-introduced
:as-alias option in require does not cause a namespace to be loaded and therefore does not introduce a dependency from the requiring namespace on the namespace being used in
poly doesn't recognize
:as-alias so it thinks any such requires are full ns loads and full dependencies. At work, this surfaces as a circular dependency complaint (which it isn't).
I have a fork of Polylith that modifies the
namespaces_from_disk.clj file so it essentially ignores such namespaces. That isn't quite the right solution, because it prevents
poly from checking that you're only referring to an
interface (if the ns is in another brick) -- it does, however, stop
poly treating it as a fully-loaded ns and therefore it does not recursively check for dependencies.
I think a complete solution would be to annotate each ns symbol with metadata, indicating whether it's a full load or just an alias -- but that would a) propagate through a lot of
poly's namespace checking since different rules would have to apply in different places and b) any manipulation of the namespaces would need to preserve that metadata. Otherwise,
poly would have to maintain parallel dependency trees -- one that represented the complete ns graph and one that included but stopped at
:as-alias (although I suspect that still leaves open an edge around namespace A requiring namespace B which requires A
:as-alias). So I think it's a hard problem to solve correctly.
I can submit a PR of my "sledgehammer" fix, which is to ignore
:as-alias dependencies (so you lose
interface checking on them but otherwise everything else behaves "as expected").
I need to dig into this. I will be away this week, but will have a more time to look at it next week.