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

Steven Schveighoffer <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #4 from Steven Schveighoffer <[email protected]> ---
(In reply to Jonathan M Davis from comment #0)

> The reason that's usually given as to why const is legal on the left-hand
> side is because all function attributes can go on either side of the
> function, and it would be inconsistent to disallow const, immutable, or
> inout on the left. But that's not even true! As issue# 12930 shows, static,
> private, public, package, and protected are all illegal on the left.

You mean "illegal on the *right*"

Some questions:

these are currently also legal and equivalent to your example:

const: Bar foo() {...}
const{ Bar foo() {...} }

Those OK or not? I'd say yes, because the only really confusing one is where
the const seems to apply to Bar. In those cases, const looks more like a
class-level attribute, and don't appear to apply to the return type.

Come to think of it, this is also not ambiguous:

const void foo() {...}

But I think this should also be disallowed for consistency

Also, shared is in this category, as it is a type constructor.

9 votes in 7 days, must be some sort of record :) I'll add mine shortly. I
would guess that there would be zero

--

Reply via email to