On 11.03.2009, at 23:34, Chouser wrote: > Interacting directly with a class dict feels a little dirty, because > you could be circumventing the API provided by the class methods, > making it easy to get the object into a bad state. Clojure's maps > being immutable reduces the amount of trouble you can cause by dealing > directly with the map.
Not really. Most map operations, such as assoc and dissoc, return a map with the same metadata as the input map. The result thus looks like being of a specific type, even if dissoc just removed a key that is important for that type's semantics. > I don't know if that leads to any particular conclusion. My main conclusion is that Clojure's system is a lot more flexible but also a lot more fragile. Any function can modify data of any "type" (as defined by metadata), even without being aware of this. Any function can at any time modify the global inheritance hierarchy in any way it wants. Any module can add an implementation for any type to any multimethod. That opens the way to many interesting strategies for data handling, but also to errors that will probably be hard to track down. Konrad. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---