From: matz@... (Yukihiro Matsumoto) Date: 2003-12-29T01:15:32+09:00 Subject: Re: [BUG] Can't call to_s on a frozen Date Hi, In message "[BUG] Can't call to_s on a frozen Date" on 03/12/28, Gavin Sinclair writes: |Interesting... | |irb(main):008:0> Date.today.freeze.to_s | |TypeError: can't modify frozen object Because Date object cache calculated values. matz. p.s. I sent this mail directly to gsinclair due to its reply-to, then he wrote me a reply: --- On Monday, December 29, 2003, 1:01:55 AM, Yukihiro wrote: > Hi, > In message "[BUG] Can't call to_s on a frozen Date" > on 03/12/28, Gavin Sinclair writes: > |Interesting... > | |irb(main):008:0>> Date.today.freeze.to_s > | > |TypeError: can't modify frozen object > Because Date object cache calculated values. Should this be "fixed"? It seems crazy to me that a Date can't be printed merely because it has been frozen. Gavin --- And my answer for his question is "I don't know". It's just a matter of trade-off. By caching, Date has better performance. Fixing this problem costs us either worse performance or less maintainability. I'm not sure if freezing dates is so important or not. matz.