On 2013-05-24 02:01, Walter Bright wrote:

Don has an excellent point. His case is bolstered by this causing Tango2
to fail to compile with error messages that have no obvious relationship
with this change.

Worse, as Don points out, this can result in silent breakage. Not
everyone writes code that is 100% tested, and shipping code that no
longer works would make someone justifiably very upset.

The -transition=field detects such cases, but the user will not
necessarily know to run it.

So, I agree with Don. As it is, this is unacceptable, despite my
agreement that it does make the language better. Therefore, I propose
the following addition of a warning:

------------------------------
    const int q = 5;

Warning: const field with initializer should be static or enum.
------------------------------

Over time, this can be upgraded to a deprecation and then an error.

After a suitably long period of time as an error, then we can allow it
with the new behavior.

I like that idea. It doesn't suddenly breaking existing code. Gives a bit of transition time.

--
/Jacob Carlborg

Reply via email to