On the datatypes chapter of Programming Clojure 2nd edition (page 155) there’s the following bit where the CryptoVault is extended to support the default input streams:
The calls to spit/slurp didn’t work on my tests at first, even reloading the namespace.
After a few tests, it turns out that it was because I was using an instance of the type that was created before I had extended the type, so it didn’t have the necessary associations.
It appears that an instance keeps the function associations of when it was created, instead of referring to the latest definition… probably because it’s an entirely different type that just happens to have the same name.
Somewhat surprising at first but makes sense immediately if you think of the type not as being reloaded, but redefined.
Published: 2014-11-28