I have a patch for EdnReader which enables the following behavior:
https://www.refheap.com/paste/43476cfab0a829957d6e1967fYou can pass read-edn an :alias map in opts, which maps namespace alias symbols (or nil for keywords like "::foo") to their resolved namespace symbols:
(read-edn-string {:aliases {'foo 'com.example.foo, nil 'com.example}} "[::foo ::foo/foo]") ;; [:com.example/foo :com.example.foo/foo]An :alias-default function can also be provided which will be called with an unresolved keyword, returning whatever the entire aliased keyword should read to. The nil key seems funky (maybe a separate option instead?), and I think it may be wrong that if alias-default returns nil, an "invalid token" exception is thrown.
Here's the patch I've got so far:
https://www.refheap.com/paste/11132I've tested this for Datomic schema .edn files. With this patch, I find it more bearable to use longer namespaces. In code interacting with the schema,
I can see, though, that ::keywords were intentionally left out of edn. Why?
I'd also like Namespace-decoupled aliasing for LispReader, since my ident namespaces do not always correspond to Namespaces, but I'd like to alias them in Datomic code (also, there is the separate case of ClojureScript macros). For now I'll just keep using shorter (and more collision-prone)
namespaces, or just accept the noise of longer namespaces. The utility of namespaced schema idents is definitely more important to me than reducing this
noise.