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