[REBOL] Re: On mutability and sameness
From: agem:crosswinds at: 18-Jun-2001 3:52
RE: [REBOL] Re: On mutability and sameness
[kenneth--nwinet--com] wrote:
> Joel, I'm being dense again.
>
> When you say the integers are immutable in Rebol (implying they may be
> mutable in other languages?); I'm seeing a distinction without a difference.
>
> You referred to mutating verses replacing.
>
> > a: 42
> > a: a + 1 ;=43
>
> Could I not see this as an example of mutating the rightmost bit?
> ...or perhaps...
> Are you saying a new symbol 'a' is created in a table so that the place
> where 42 is stored is unrelated to the place where 43 is stored?
> ...or...
> The truth is out there (but unlike the x-files I'm about to be enlightened!
> ;-))
>
> > Mutable: capable of being changed; read/write
> > Immutable: incapable of being changed; read-only
>
hm. "particle physics"?
Mutable: the original value is "slow" and can be modified.
Immutable: if you touch the value, it immediate "flips out", is automatic copied before.
no chance to be fast enough for a change ;-)
You see, very simple types are very flippy, a bit more complex types are somewhat slower
and heavy series are really mutable slow.
prove:
a: 42
a: a + 1 ; touch a, 42 flips out, add 1, then assign the value to a, changed, hehe
but
a: 23:55
a/1: 56 ;touch 23:55, 23:55 yawns, 23:55 is changed. without explicit assignment
and
a: 1-Apr-2001/23:55
a/time/minute: 56 ; to slow, 23:55 flips out, a unchanged
a/time: 23:56 ;fast enough :)
so we should replace 'Immutable with 'flippy? ;-)
-Volker