[Issue 15563] synchronized can't be used as a postfix qualifier

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 27 14:15:13 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=15563

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
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

--


More information about the Digitalmars-d-bugs mailing list