On Fri, Apr 24, 2009 at 2:21 AM, AndrewC. <mr.bl...@gmail.com> wrote: > If client code is using assoc and get then you haven't really started > thinking of your map as a new data type - you're still thinking of it > as a map.
I disagree with this assertion, and the comparison to the SICP example. Unlike Scheme, Clojure is factored into a number of interfaces that are usable across a wide number of objects. assoc and get are part of the interface to set and get things in *any* associative structure. They are the logical choice to access fields of new "objects". It would feel rather un-Clojurian (to me) to have to invent new accessor functions for every single new datatype you create, rather than using the existing interface for associative access. The problem, of course, is that there is a language design principle that has evolved in the OO community that client code shouldn't need to know whether you are accessing a field or a method. In Clojure, things kind of break down when you switch from using something in a "field-like" way to a "method-like" way. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---