On Dec 6, 2007, at 9:11 PM, Yukihiro Matsumoto wrote: > In message "Re: issue with Date class freeze" > on Fri, 7 Dec 2007 09:31:36 +0900, "Christopher Gill" > <gilltots / gmail.com> writes: > > |I've come across some strange behavior in Ruby 1.8.6 (2007-09-24 > |patchlevel 111) [i686-darwin8.11.1] that I can't reproduce in Ruby > |1.8.5 and I'm wondering if this would be considered a bug, or if > there > |is a workaround. > > Date objects are modifies itself to cache calculated result. Since > no other self-modifying methods are exposed, you don't have to freeze > it in general. How about making Date#freeze compute the cached to_s string and then call super? That keeps the lazy to_s behavior as well as supporting freeze semantics. Gary Wright