On 10/10/14 11:15 AM, Martin Nowak wrote:

As this is more about stating a clear preference than deprecating the
old syntax let me propose a compromise.

- adding RHS rule to D's style guide http://dlang.org/dstyle.html
   with an explanation what the storage class function thing does

- change any dmd formatting code to RHS and change our documentation

- leave the rest to linting tools like
https://github.com/Hackerpilot/Dscanner

This is a case of the compiler doing the *wrong* thing when requested to do something else.

When I say:

const int
foo() { return 1;}

I mean I want foo to return a const int. The compiler does the *wrong* thing, and instead applies const to the hidden this parameter.

In most cases, the result is a confusing error message, because most of the time, it won't compile. But in some cases, it will compile and do something completely incorrect.

This is not a problem of specification, this is a problem of human semantics. The specification is sound, correct, and completely confusing to real people.

To avoid the confusion, we put the const on the right side. While not *completely* intuitive, it's much clearer what const applies to.

I think leaving this to a lint tool basically is as good and effective as doing nothing. It's not a compromise at all.

-Steve

Reply via email to