Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: On mutability and sameness

From: sanghabum:aol at: 5-Jun-2001 18:07

Hi Scott,
> 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
Well, it is certainly odd, and non-orthogonal. For example, the same Poke on a Block or an Object does change it:
>> myblock: copy [1 2 3 4 5]
== [1 2 3 4 5]
>> poke myblock 3 99
== [1 2 99 4 5]
>> myblock
== [1 2 99 4 5]
>>
But Poke on a Tuple or Money does not chance the underlying item. Poke accepts any of these data types: series money date time object port tuple. If it was orthogonal, I wouldn't have to try each type to see if it changes the value or not. Any guesses what it does to a Date or a Port? --Colin.