It took a few moments for me to scratch my head and then I thought
that the reason that there was no message when c[0] or f changed was that
c[0] is not an object but a reference to an object (the number 2).
So I searched the archives and it appears taht my reasoning is
correct. I think.
there was the suggestion to make f a constant, F. Yes, that generates
a warning ... but it is not what I want. I want to freeze the
reference as well as the object.
In C++ it is possible to "freeze" (i.e. const) both a pointer to an
object and the object itself. Is this possible in Ruby?
a) Is my reasoning correct?
b) Is there a way to do what I want? That is, freeze f or c[0] so that
I get some sort of message/error/exception?
But I will repeat part of the question: Is there a way to detect ...
in the general case ... that the reference to an object has changed?
In a more C-like environment, a debugger is able to detect (via
hardware) that a location in memory has changed. Is something similar
available in Ruby?
Where is the Ruby debugger (watch, etc.) documented?
Ralph
Thursday, November 5, 2009, 7:14:11 AM, you wrote:
···
Hi,
In message "Re: Freeze not freezing" > on Thu, 5 Nov 2009 23:05:28 +0900, Ralph Shnelvar <ralphs@dos32.com> writes:
>a) Is my reasoning correct?
#freeze protect an object from modification. The reference is not the
target of freezing.
>b) Is there a way to do what I want? That is, freeze f or c[0] so that
>I get some sort of message/error/exception?
You can protect an array (or object) as a whole, since it is an
object, so that
On 2009-11-05, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
From my viewpoint, C++ violates POLS.
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net | Seebs.Net <-- lawsuits, religion, and funny pictures Fair game (Scientology) - Wikipedia <-- get educated!