Thread overview
[Issue 15563] synchronized can't be used as a postfix qualifier
Jul 02, 2017
Vladimir Panteleev
Oct 28, 2022
RazvanN
Jun 27, 2023
RazvanN
Jun 27, 2023
Nick Treleaven
July 02, 2017
https://issues.dlang.org/show_bug.cgi?id=15563

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
           Priority|P1                          |P5
           Hardware|x86                         |All
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=17580
                 OS|Mac OS X                    |All

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
> void register(Socket s) synchronized {

Is that valid code? See issue 17580

--
October 28, 2022
https://issues.dlang.org/show_bug.cgi?id=15563

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |razvan.nitu1305@gmail.com

--
June 27, 2023
https://issues.dlang.org/show_bug.cgi?id=15563

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

--
June 27, 2023
https://issues.dlang.org/show_bug.cgi?id=15563

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #3 from Nick Treleaven <nick@geany.org> ---
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.

--