On 29 May 2013 11:18, Kenji Hara <k.hara.pg@gmail.com> wrote:
2013/5/29 Manu <turkeyman@gmail.com>
Either way, the attribute certainly looks like it's part of the declaration, I think any reasoning programmer would assume that it is. It's only a DMD implementation detail that says otherwise, and it's not particularly intuitive to a programmer.

It's not a dmd implementation detail. It is part of current D language design. dmd works as well. No bug there, so this is definitely an enhancement.

But I can agree that is a little not good from human sense. I know a related issue.

struct S {
    immutable int foo() {}    // immutable is prefix attribute (==storage class)
}

In above, `immutable` would be applied to the declaration `foo`, not its return type `int`.

But, changing semantics would break much existing code. Your enhancement belongs same area. We need to get agreement of D programmers first.

Yeah, that's a good point, I've never liked that ambiguity.
I always write: immutable(int) foo() {}
Otherwise I never really know what to expect.