Bug 12930 – static and the access modifiers aren't legal on the right-hand side of a function
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-16T08:49:38Z
Last change time
2019-08-11T17:16:02Z
Keywords
spec
Assigned to
No Owner
Creator
Jonathan M Davis
Comments
Comment #0 by issues.dlang — 2014-06-16T08:49:38Z
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.
Comment #2 by pro.mathias.lang — 2019-08-11T17:16:02Z
At this point I don't think anyone will disagree that 12931 is the way to go.
Closing as duplicate in order to not confuse contributors looking for work :)
*** This issue has been marked as a duplicate of issue 12931 ***