On 1/6/2000 at 9:24 AM [EMAIL PROTECTED] wrote: {{
The specifications for
other languages, such as Python, specifically state that certain
data types are immutable, in the sense that one cannot modify a
value, but only construct a new one.
}}
So in terms of Pascal and C, "constants" would be immutable datatypes?
And, although it looks and feels like we are changing the value of A
with something like
>> a: 1
>> a: 2
And Ladislav is saying that we are really unsetting A from the
immutable integer value 1 and resetting to another immutable integer
value, 2 (or EX-changing one value for another).
The word is mutable, but the integer value is not?
-Ted.
*********** REPLY SEPARATOR ***********
On 1/6/2000 at 9:24 AM [EMAIL PROTECTED] wrote:
Hi, Ted, Ladislav, and all...
[EMAIL PROTECTED] wrote:
>
> Can you provide a definition of mutable and immutable, Ladislav, and
> explain why it's important.
>
I think I'm to blame for introducing the word "immutable" into this
thread, so I'll throw in my understanding. The specifications for
other languages, such as Python, specifically state that certain
data types are immutable, in the sense that one cannot modify a
value, but only construct a new one.
One implication of immutability is security; if a data type is
immutable, then a value of that type may be passed around freely
among various routines without fear of side-effects or hackery.
In Java, string immutability is explicitly a security issue; a
thread can construct a string, validity check it, and spawn off
a new thread to do something interesting with it WITHOUT the
possibility that yet another thread with a reference to that
string can change its content post-validation but pre-usage.
This also is common in "pure functional" languages, for more
philosophical reasons.
>
> If a word is protected, is it then suddenly immutable, or is it a
> deeper question than that?
>
No, it's not immutable, assuming that there is also an "unprotect"
mechanism. Immutable means that at a fundamental level the type
doesn't even support the IDEA of changing a value.
A box with a lock on the lid (especially assuming that there are
keys or bolt cutters available somewhere ;-) is very different
from a hermetically sealed container with no lid at all.
[EMAIL PROTECTED] wrote:
>
> mutable <=> series
> immutable <=> scalar
>
> are pure coincidence, because you can have immutable series and
> mutable scalars. It is simply a matter of preferences of the
> implementor.
>
Since "series" and "scalar" in this conversation are REBOL terms,
I'd say the preference of the implementor is the definition.
-jn-