core-typed

Martin Jul 2022-10-04T10:42:58.642599Z

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-namewith 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?

2022-10-04T18:35:29.857729Z

Hi @martin303 have you tried importing the record into your namespace? Classes should resolve using the same rules as normal.

Martin Jul 2022-10-07T09:37:56.784129Z

@ambrosebs 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 defaliasit in the local namespace.

Martin Jul 2022-10-07T09:38:26.680399Z

(similar to the fully qualified name Java class name that I used)

Martin Jul 2022-10-07T09:42:30.610639Z

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

2022-10-07T18:43:29.544339Z

exactly. The intention was that you'd refer to the symbols "normally" in both cases, since defalias's used to intern vars.