From: "Adam P. Jenkins" Date: 2006-02-14T05:38:26+09:00 Subject: Re: Equivalent of const modifier > I'd call freeze, except that would freeze the original a as well. Unless your code is multithreaded, you could always just unfreeze the arguments when the function exits, since nothing else will be accessing the objects while mymethod is executing. David Vallner wrote: >># This looks at, but doesn't modify, a and b >>def mymethod(a, b) >>end >> >>In C++ I can do this with the const modifier. > > > Well, with the risk of stating the obvious, Ruby isn't C++. Some things are > plain done differently. Or not at all. Also, C++'s const is like Ruby's private, in that there's an easy way to get around it: instance_eval to get around private, const_cast to get around const. So it's just an advisory flag anyway, and doesn't guarantee anything.