On Thu, Dec 23, 2010 at 9:28 PM, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > Am 23.12.2010 um 15:26 schrieb nicolas.o...@gmail.com: > >> Is there a way to make some mutable fields public in a deftype? > > I think it is opinionated, that this is not possible as the documentation > states explicitly that the fields will be private when made mutable. You > could write a special protocol or interface with getters/setters. However > this somehow is ugly and undermines the original intention. >
Thanks for your answer. I think it is a good opinionated choice, because it is the best choice most of the time. However, in some specific case, I would like to have a way (even if you have to jump through a few hoops) to have public mutable fields. I have currently a file with a protocol per type with getter and setter, which is quite anti-idiomatic. There is no real protocol or overloading needed anywhere in this code, as it is very low-level. Would that be a lot of work to had a ^:public-unsynchronized-mutable and ^:public-volatile-mutable? If I were to write such a patch, would it be accepted? Best regards, Nicolas. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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