Hi, Am 31.12.2011 um 05:36 schrieb Peter Taoussanis:
>> I guess what I'd like a mode where I can say "act like read/pr" and> for >> deep-freeze to ignore metadata, refs and atoms. > > I'm still not sure I'm getting this argument though. In its current > form, deep-freeze makes an attempt to preserve as much information as > it can. In the specific case of STM/metadata it happens to preserve a > little more information than read/pr. I think, what James wants to say is: serialising reference types is non-trivial. Reference types are identities. So the instance itself (as in identical?) carries information. When you have references to a ref you have to make sure that they all refer to the same ref again after thawing. Let's say you have a data structure like this: (let [left-and-right (ref :state)] {:left left-and-right :right left-and-right}) What is the state of this map after thawing? Does it refer to the same ref? Or different ones? If it's different ones, your program is broken now. If left-and-right was a value, the program would now need more memory, but it would be still ok. Looking at the source of deep-freeze your program will be broken after a round trip. You'll need to add a marker for the identity and kind of memoize the thaw function for refs on this marker, so that it returns the same ref again. Ironically pr provides this information already. So I would rather say that pr preserves more information than deep-freeze in this situation. BTW: Do you wrap everything in a dosync when freezing a data structure? If not, you cannot guarantee that refs are frozen in a consistent state. Many, many pitfalls. Freezing and thawing of reference types play in a different league than freezing and thawing of values. There needs more thought to go into that. (And the fact that read/pr doesn't support reference types (yet), should be a hint that this is not a simple puzzle for an afternoon.) Just my 0.02€. Sincerely Meikel -- 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