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

in UnitTest::invariant I want something like this (this code doesn't
work):

class UnitTest
        ....
        def invariant(aObj)
                aObj.freeze
        end
        ....
end

What am I missing, yes I know aObj is a reference thus freezing it does
freeze the actual param.