"Gavin Sinclair" <gsinclair / soyabean.com.au> schrieb im Newsbeitrag
news:721279650.20040616004600 / soyabean.com.au...
> On Tuesday, June 15, 2004, 7:43:36 PM, Robert wrote:
>
> > Btw, do people frequently use #freeze?
>
> I use it occasionally.

Ah!  *You* are the one... :-))

> BTW, Date.today.freeze.to_s gives an error too.  When I raised it on
> ruby-core Matz agreed it's an issue but didn't really know off hand
> how to fix it.  (The problem is caused by caclulations on instance
> vars for caching - I think.)

Most likely.

> And I guess one could write their own #to_s or #inspect in particular
> cases if it were a problem for them.

The cleanest might be to introduce something similar to C++'s keyword
'mutable', which allows instance variables to be changed even if the
container is const (aka frozen).  But I don't like this approach because
things soon get messy.  Constness is difficult to get right (not so much
for the language but rather for users of the language) IMHO.

Alternative solutions could make use of WeakReference somehow, although
this is just a faint idea - nothing concrete.

Kind regards

    robert