Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function
Brad Anderson via Digitalmars-d
digitalmars-d at puremagic.com
Thu Oct 9 09:46:48 PDT 2014
On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:
> Kenji just proposed a slightly controversial pull request so I
> want to reach out for more people to discuss it's tradeoffs.
> It's about deprecating function qualifiers on the left hand
> side of a function.
+1.
Prefixed const is so often a mistaken attempt to return a const
that when I see someone post for help in IRC about "cannot
implicitly convert expression" I immediately look for a "this" in
the error message because that usually means they are using
prefixed const function attribute when they intended to return a
const variable.
This reminds me quite a bit about Walter's explanation on FLOSS
Weekly about why D disallows shadowing local variables. It can be
used correctly just fine but it's so often used incorrectly that
we're better off disallowing it completely.
More information about the Digitalmars-d
mailing list