const as default for variables
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 17 12:53:13 PDT 2015
On Tuesday, 17 March 2015 at 13:55:36 UTC, Dejan Lekic wrote:
> I definitely think this is a good idea. And if someone wants
> mutable variable, we simply use proposed 'var' storage class.
This is going to break pretty much all the code that use auto.
The benefice for the compiler is hypothetical. Walter is right
when mentioning that is can remove some refcount boilerplate,
which is right but, we have no idea how much, and how good the
compiler would be at recognizing them. With existing languag
feature, the compiler CANNOT leverage this change for
I'd consider this if it was from scratch, but in the current
state of affair, it is a change that does not pay for itself.
Switching to @safe by default for instance will break less code
while providing more.
More information about the Digitalmars-d