accept @pure @nothrow @return attributes

via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 28 09:42:17 PST 2015


On Monday, 26 January 2015 at 19:59:58 UTC, H. S. Teoh wrote:
> On Mon, Jan 26, 2015 at 11:50:19AM -0800, Walter Bright via 
> Digitalmars-d wrote:
>> On 1/26/2015 3:39 AM, Jonathan M Davis via Digitalmars-d wrote:
>> >Personally, I'd much prefer that we not make this change.
>> 
>> It's good to have this discussion.
>> 
>> Previously, it's all been advocacy and "break my code" by 
>> forcing a
>> change from pure => @pure.
>> 
>> Just a few days ago on slashdot, an anonymous D user wrote:
>> 
>>   "A horrible mix of keywords and annotation syntax for
>>   function/method attributes ('const', 'pure', and 'nothrow' 
>> are all
>>   keywords, but '@property', and '@nogc' are annotations)"
>> 
>> for why he won't use D anymore.
>> 
>> Frankly, I think that is a great bikeshedding non-issue that 
>> distracts
>> us from what is important. I hope that by doing this PR, we can
>> actually decide that it isn't worth it, i.e. I'd be happy to 
>> get
>> consensus and revert it.
>
> While I generally agree with the sentiment that this great 
> debate over
> syntax is distracting from more important issues, one 
> particularly
> attractive point about forcing @ on annotations is that const 
> (as a type
> qualified) and @const (as a function annotation) become 
> syntactically
> distinct:
>
> 	const int myFunc() @const {}
>
> vs. the current confusing syntax:
>
> 	const int myFunc() const {}
>
> Does this alone make it worth it? I'm skeptical. But I thought 
> it should
> be pointed out regardless.

I wouldn't count `const` among functions annotations. It applies 
to `this`, not to the function.


More information about the Digitalmars-d mailing list