It seems to me that immutability can be used as a signal to the compiler to 
optimize (by applying const to it), so the goal of immutability is 
increasing speed not reducing it.

I remember doing reading on array allocation for a semi-related subject on 
SO, and here it is:

Julia initialized array vector is not zero but random 
<http://stackoverflow.com/questions/23903965/julia-initialized-array-vector-is-not-zero-but-random/24670303#24670303>

It turned out that the test for being able to store values unboxed in an 
array was immutability, and in fact for this purpose primitive types 
(Float, Int, etc) are considered immutable.  This is of course is an 
advantage because then everything is stored contiguously and not maintained 
separately as objects (I think #3 is correct).

It seems that whenever an array element gets "pulled out" of the array by 
probably getindex, then it becomes boxed implicitly which would be 
necessary if the value were referred to a variable, but these immutable 
types are mutable while they exist in an array. 

Seems like there's the possibility of a viable way to update the contents 
of an array using unboxed elements either primitive or composite without 
having to create an intermediate.  Lets call them transmutables.

Reply via email to