Hi Rich, Am 07.01.2009 um 17:10 schrieb Rich Hickey:
Thanks Meikel. I have a couple of points: First, making derive and underive act on vars instead of the hierarchies directly is not good - it reduces the generality needlessly. Good practice is to make pure fns, then do the reference part, not mix the two. Second, there's no reason to bind MultiFn to Var - any IRef will do. Then people can put their hierarchies in Atoms/Refs or whatever. Third, I don't see the need for defhierarchy at this point.
Ok. My problem is, that passing the hierarchy directly doesn't allow adding further derivations. The only idea I had, was to use Vars. I didn't like the idea, but I couldn't come up with another one. The solution is again an abstraction: IRef. Changing (un)derive and adding defhierarchy, was just some try to help the user with the limitations of this approach. But (dosync (alter ref-to-hierarchy derive ::Foo ::Bar)) works perfectly. :) Much cleaner indeed. This shows again: ugly solutions and special cases are a sign, that one does it wrong... Please find attached another patch going for IRef instead of Var directly. And without the other cruft. Sincerely Meikel
issue-8b.diff
Description: Binary data
smime.p7s
Description: S/MIME cryptographic signature