[dmd-beta] dmd 2.063 beta 5

Steven Schveighoffer schveiguy at yahoo.com
Thu May 23 12:13:46 PDT 2013


On May 23, 2013, at 1:35 PM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:

> On Thursday, May 23, 2013 11:52:41 Steven Schveighoffer wrote:
>> 2. Disable the error with a switch
>> (to allow for the new behavior). I believe the current solution is to use
>> a switch to *find* the possibly offending usages. I think an opt-in
>> approach is better.
> 
> The problem with it being opt-in is that it will break people's code without 
> them even having a clue that anything was changed. The change needs to result 
> in actual errors in their code, or they won't have a clue and won't fix their 
> code.

I think there's a misunderstanding here.  The proposal is to cause an error UNLESS you add a switch to the compiler.  In other words, you have to opt-in to get the new behavior.

Doing nothing, just running your existing build command, you get an error.  Then you have to either:

a) fix all the locations, moving them to static (or realizing your code had a huge bug originally because you thought that was an actual member)
b) if you plan on using the new feature, add the -enableNewFeature switch (name obviously TBD).

The error message should be something like:

Error: initializing a const instance member needs -enableNewFeature compiler switch, or must be changed to static.

-Steve



More information about the dmd-beta mailing list