Poll: Would you like to try const-by-default or not?
Bent Rasmussen
incredibleshrinkingsphere at gmail.com
Tue Jun 12 15:07:49 PDT 2007
> I don't like this idea at all. Both "default" ways would only break some
> existing code, this would break all existing code. In addition, it just
> seems needlessly verbose, and I'm sure I'm not the only one who hates
> having to type a
I agree.
> pointless "var" in front variables in JavaScript or "my" in strict Perl (I
> know this would be for parameters, but it's the same general idea).
I don't see var as pointless; in global scope it's optional; in function
scope it depends on whether you want it to be local or not. It's certainly
less verbose than having to add type annotations. C# will have var as well,
but with type-inference and probably some support in Visual Studio to show
show inferred types. That, coupled with intellisense, should be a nice
productivity boost.
An all-const approach with var for mutables would be interesting, if
feasible... It reminds me of Single Assignment C (SAC), although I've never
tried that.
Bent
More information about the Digitalmars-d
mailing list