Template args to UDA's

Manu turkeyman at gmail.com
Tue May 28 18:28:06 PDT 2013


On 29 May 2013 11:18, Kenji Hara <k.hara.pg at gmail.com> wrote:

> 2013/5/29 Manu <turkeyman at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130529/514d50d4/attachment.html>


More information about the Digitalmars-d mailing list