Bug 15563 – synchronized can't be used as a postfix qualifier

Status
NEW
Severity
enhancement
Priority
P5
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-13T17:09:44Z
Last change time
2024-12-13T18:46:33Z
Keywords
bootcamp, spec
Assigned to
No Owner
Creator
deadalnix
See also
https://issues.dlang.org/show_bug.cgi?id=17580
Moved to GitHub: dmd#19089 →

Comments

Comment #0 by deadalnix — 2016-01-13T17:09:44Z
void register(Socket s) synchronized { Error: semicolon expected following function declaration
Comment #1 by dlang-bugzilla — 2017-07-02T00:24:50Z
> void register(Socket s) synchronized { Is that valid code? See issue 17580
Comment #2 by razvan.nitu1305 — 2023-06-27T14:15:13Z
The grammar [1] doesn't seem to support this. It seems that only member function attributes (those that refer to the context pointer - const, inout, immutable etc.) and safe, pure et al. are allowed as postfix qualifiers. Storage class qualifiers seem to be left out on purpose. I think the reasoning was that safe, pure, nothrow etc. can be used as pre- and post- fix qualifiers for any function, whereas const, inout etc. should only apply to the context pointer. It would be weird to see: void register(Socket s) pure nothrow synchronized @safe return {} although: void register(Socket s) pure nothrow const {} is equally weird. [1] https://dlang.org/spec/grammar.html#MemberFunctionAttributes
Comment #3 by nick — 2023-06-27T20:25:56Z
So should storage classes which only apply to functions be added to FunctionAttributeKwd? abstract final override synchronized It seems inconsistent only to allow nothrow and pure as postfix. OTOH perhaps function attribute keywords should be allowed as @attributes, then they would be supported already as postfix.
Comment #4 by robert.schadek — 2024-12-13T18:46:33Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19089 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB