[dmd-beta] dmd 2.064 beta take 2

Walter Bright walter at digitalmars.com
Wed May 15 14:14:57 PDT 2013


On 5/15/2013 12:07 PM, Andrei Alexandrescu wrote:
> On 5/15/13 3:02 PM, Walter Bright wrote:
>> I believe it was disallowed in earlier D2 versions. If I saw such code
>> in a project, I'd find it awfully suspect, not sensible.
>
> On the contrary, examples abound. Consider:
>
> class Image {
>     const double scalingFactor = 1.0; // no scaling
>     this(double sf) {
>         scalingFactor = sf;
>         ...
>     }
>     ...
> }
>
> What is suspect about this? I have about five others without even needing to 
> think that hard.

It means I can't read the code and easily determine what that const value is, 
even though it is explicitly initialized with a value.


More information about the dmd-beta mailing list