|
|
|
|
|
by ptx
1466 days ago
|
|
> Variables aren’t immutable in any significant way because you can trivially turn an immutable reference into a mutable one. To be fair, they didn't claim that the values were immutable, only the variables. Isn't the example in the article basically the same as Java's final variables, i.e. immutable references to mutable values? > No global variables [...] Evaluation: V does not prevent you from creating and mutating globally shared state in any meaningful way. Although I agree with the evaluation, the claim of "no global variables" might still hold, assuming it refers to mutable global variables. The global constant holds an immutable reference to a mutable value, just like how in Java a singleton object (or a class with mutable static fields) can be used to simulate global variables. |
|