[REBOL] Re: On mutability and sameness
From: gjones05::mail::orion::org at: 5-Jun-2001 13:24
From: "Colin"
> Some of it might simply be oversights in the depth of the Rebol code.
Take
> another example, this one with tuples:
>
> >> mytuple: 1.2.3.4.5
> == 1.2.3.4.5
> >> poke mytuple 3 88
> == 1.2.88.4.5
> >> mytuple/2: 99
> == 99
> >> mytuple
> == 1.99.3.4.5
> >>
> The Poked 88 has vanished! Magic!! Or maybe just a fault awaiting a
fix.
> (Reported as helpdesk ref #5630)
I got caught by a similar problem once.
USAGE:
POKE value index data
DESCRIPTION:
Returns value after changing its data at the given index. (See
manual)
POKE is an action value.
ARGUMENTS:
value -- (Type: series money date time object port tuple)
index -- (Type: number logic)
data -- new value (Type: any)
One might argue that this description might be worded more clearly, but
poke is doing what its says it is doing:
mytuple: 1.2.3.4.5 ; == 1.2.3.4.5
poke mytuple 3 88 ; == 1.2.88.4.5
;it presents a changed value, but doesn't "change" mytuple
mytuple ; == 1.2.3.4.5
mytuple: poke mytuple 3 88 ; == 1.2.88.4.5
mytuple ; == 1.2.88.4.5
For what its worth...
--Scott Jones