Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 9 04:38:35 PDT 2014


On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:
> Would this affect your code?

I've written code before in the style:
@property pure nothrow const //<- HERE
int foo();

So anybody else using this style might be affected.

But even then, I agree. D has always been about "if it's 
ambiguous, dangerous, and can be avoided, don't make it fucking 
legal".

> Do you think it makes your code better or worse?
> Is this just a pointless style change?
> Anything else?

I'm not really sure about the: "Then at some future point we 
could apply the left hand side qualifiers to the return type, 
e.g. `const int foo();` ==  `const(int) foo();`"

I don't think it buys us anything, except maybe silently changing 
semantics of code that hibernated through the deprecation process.

I mean, sure, it might be a little surprising, but it's not the 
end of the world.


More information about the Digitalmars-d mailing list