accept @pure @nothrow @return attributes
Jonathan Marler via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jan 26 16:05:15 PST 2015
On Monday, 26 January 2015 at 23:55:55 UTC, Zach the Mystic wrote:
> On Monday, 26 January 2015 at 23:53:22 UTC, Jonathan Marler
> wrote:
>> http://en.wikipedia.org/wiki/Straw_man
>>
>> I'm not proposing that we don't allow attributes before a
>> function, I was mentioning an idea related to my proposal. I
>> agree with everything you said, you're just not addressing the
>> proposal itself (see the link).
>
> Show code examples of how it would work. I can't guess anymore
> what you're proposing.
Haha, ok, sorry for being too abstract.
I think a safe way to implement my proposal would be to do what
c++ did and only allow non-keyword function attributes to omit
the '@' symbol if they appear after the function signature:
Here's what would change
-----------------------------------------------------------------
void myfunc() nogc; // VALID (Only if this proposal is accepted)
void myfunc() safe; // VALID (Only if this proposal is accepted)
Here's what WOULD NOT change
-----------------------------------------------------------------
nogc myfunc(); // STILL INVALID: invalid unless it can be verified
// that this wouldn't result in ambiguity
// in the grammar
void myfunc() @nogc; // STILL VALID (no change)
@nogc myfunc(); // STILL VALID (no change)
If the initial proposal is accepted by people, then we can talk
about the other examples, but let's focus on the proposal before
focusing on sub-proposals.
More information about the Digitalmars-d
mailing list