This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-04
Channels
- # aleph (23)
- # announcements (1)
- # babashka (21)
- # beginners (70)
- # biff (3)
- # cider (8)
- # clj-kondo (45)
- # clj-yaml (9)
- # clojure (69)
- # clojure-europe (82)
- # clojure-nl (1)
- # clojure-norway (2)
- # clojurescript (34)
- # conjure (19)
- # core-typed (6)
- # cursive (2)
- # events (5)
- # fulcro (55)
- # honeysql (1)
- # integrant (18)
- # jobs (1)
- # lsp (124)
- # malli (10)
- # meander (1)
- # off-topic (26)
- # polylith (8)
- # reagent (7)
- # releases (1)
- # remote-jobs (1)
- # sci (2)
- # shadow-cljs (19)
- # squint (5)
- # vim (17)
- # xtdb (31)
A question about defalias
(using Typed Clojure 1.0.32). Is there a way to make a defalias
using the symbolic name of a record (`ann-record`) from another namespace? It accepts the the JVM classname of the record, e.g. (t/defalias Foo that.other.namespace.full_name.Foo)
as an alias for something in ns that.other.namespace.full-name
with a (t/ann-record Foo ....)
for a (defrecord Foo ...)
. Is there way to write (t/defalias F fnalias/Foo)
or is this just for non-record types?
Hi @U040NGRHA4B have you tried importing the record into your namespace? Classes should resolve using the same rules as normal.
@U055XFK8V Thanks for the tip. Importing the type Foo
does makes the type to be available to the type checker, so I don't have to defalias
it in the local namespace.
(similar to the fully qualified name Java class name that I used)
Now, if I understand correctly: I can reference ann
type annotations using the normally using their Clojure names with the require
syntax and aliases. However, ann-record
type annotations must be reference using the corresponding Java class name of the record itself (e.g. underscores instead of hyphens in namespaces) and cannot reference the symbolic (Clojure) name given to ann-record