> I guess it comes down to what belongs in metadata. While errors are > certainly data about other data, they don't feel to me like metadata a > la :doc, :tag, :file, :line, and :test. They're the sort of thing I'd > show in an application's UI as part of normal user interactions, > rather than something used only behind the scenes, so they feel to me > like first-class data. >
I've found that reading Rich's description of what metadata is is a good way to see more clearly in cases such as these, specifically this passage I find helpful: "An important thing to understand about metadata is that it is not considered to be part of the value of an object. As such, metadata does not impact equality (or hash codes). Two objects that differ only in metadata are equal." So ask yourself, should the object with the errors hash in metadata be equal (as defined by the = function) to the object without the same error information? If yes, then metadata seems like a good fit. Of course, if its nonsensical to consider such a comparison then thinking about it this way may not make things any more clear. I'm not too involved with the code here, but one thing that seems dangerous about storing this information in metadata here is that if this is supposed to signify an error condition, then it is entirely possible for code to use the returned value and never realize there was an error if they didn't know to look at the metadata. If you return a different object altogether then the caller of the code will discover one way or another that the returned object isn't what they expected. ... just some thoughts ... /mike. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---