From: Jim Weirich Date: 2003-07-07T05:26:04+09:00 Subject: Re: Freezing an arbitary object On Sun, 2003-07-06 at 15:32, Aryeh M. Frierdman wrote: > Lets say I am doing design by contract and want to do a call like this: > > test=UnitTest::new > > foo=1 > test.invariant(foo) > foo+=1 # should produce an error and exit This last line can be rewritten ... foo = foo + 1 So you add 1 to a integer object which returns a new integer value (it never modifies the original integer, it "creates" a new one). This new integer value is then bound to the name "foo". The previous foo object, the frozen one, is no long accessable (through the name "foo"). -- -- Jim Weirich jweirich@one.net http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)