[Issue 12930] New: static and the access modifiers aren't legal on the right-hand side of a function
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jun 16 01:49:38 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12930
Issue ID: 12930
Summary: static and the access modifiers aren't legal on the
right-hand side of a function
Product: D
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: jmdavisProg at gmx.com
Apparently,
int foo() public
{
return 0;
}
is not legal. The public has to go on the left-hand side of the function
signature. That doesn't particularly bother me except for the fact that the
reason that const is supposedly legal on the left-hand side instead of just the
right is the fact that we're trying to be consistent and have all function
attributes be allowed on either the left-hand or right-hand side of the
function signature. That being the case, public should be legal on the right.
But it's not. The same goes for private, package, protected, and static.
Now, personally, I'd prefer that we make const, immutable, and inout illegal on
the left rather than make public, protected, package, and private legal on the
right - I don't think that the consistency of allowing const, immutable, and
inout on the left-hand side is worth amount of confusion and trouble that it
causes (it's already considered bad practice to put them on the left anyway).
But if we're claiming that they're allowed on the left for consistency, then we
should be consistent and allow _all_ of the function attributes to be on the
right-hand side - including static and the access modifier attributes.
As it stands, we've made a bad decision for const, immutable, and inout in the
name of consistency when we don't even have that consistency.
--
More information about the Digitalmars-d-bugs
mailing list