How To Refer To A Clojure Record In Another Namespace
I ran into an issue like usual. This time it seemed simple. I wanted to refer to a record that I def'd in another namespace.
The problem is, you can't just do a :require and :refer it in regular Clojure. However, in Clojurescript this is how you would do it.
What you have to do is :import it. And the key trick to keep in mind when using :import on records and Clojure namespaces is that dashes are converted to underscores like packages in Java.
If you had a namespace like (ns foo-bar) in which there was a record called MyRecord, you would do something like this:
(:import [foo_bar MyRecord])
And you'll be off to the races.
Master GitHub Actions with a Senior Infrastructure Engineer
As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.
Not sure yet? Check out the archive.
Unsubscribe at any time.