Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is not a good solution. This adds complexity (syntactically and conceptually) without adding any feature. The immutability is already implied by the 'let' and 'var'.

Additionally, specifying that the RValue "[1,2]" has mutability is meaningless. The expression "[1,2]" is represented as a constant until it is stored in a variable (it should be represented in the MACH-O constant data section). It is the variable which has the concept of mutability.

The proposal is similar to proposing the following declaration in C:

"int i = const 1;"

Which is meaningless, because the '1' can never be not-const



> The immutability is already implied by the 'let' and 'var'.

The immutability of the binding and that of the value are different concerns. let and var are about the binding's mutability, trying to munge them together only ends up in tears.

> The proposal is similar to proposing the following declaration in C:

No. The proposal is similar to the following C:

    int const * i;




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: