On 3/14/2015 3:06 PM, Xinok wrote:
For example, this could be an issue for generic functions:

     void foo(T)(T[] arr){
         T value = arr[0]; // Mutable or immutable?
     }

Not really.

    const T value = arr[0];

means that value isn't going to be subsequently reassigned or anything mutated through it.

Also, you forgot a fifth case where only part of the type is const/immutable:

5. const(T)[] x = ...

The default const'ness would apply to the [] part.

Reply via email to