accept @pure @nothrow @return attributes

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 26 17:13:59 PST 2015


On Tuesday, 27 January 2015 at 00:57:24 UTC, Jonathan Marler 
wrote:
> On Tuesday, 27 January 2015 at 00:44:14 UTC, Zach the Mystic
>> 3. Singularity of usage also matters. There should only be one
>> way to mark a given attribute, either with or without `@`.
>
> I agree that the proposal doesn't solve the consistency issue, 
> but the proposal doesn't make things more inconsistent then 
> they already are. It adds another way to write these 
> attributes, but it adds a way that makes more sense in my 
> opinion.  This is a step in the right direction in solving the 
> problem.  The next step would be to solve the consistency 
> issue, but again, that's another debate. To conclude, which 
> code would you rather write?

The consistency issue is precisely that there should not be more 
than one way to write an attribute. Note that that's precisely 
where most of the opposition to this thread's original proposal 
came from. Uniformity means never having to explain to anybody 
why there is more than one way to do something. Both this 
thread's proposal and your proposal *introduce* inconsistency in 
this way.

> void myfunc() pure @safe nothrow @nogc;
> void myfunc() pure safe nothrow nogc;
>
> This will inevitably result in someone writing this:
>
> pure safe nothrow nogc void myfunc();
>
> which would still be invalid in this proposal, and I think this 
> is still a problem but not a huge one since this is easily 
> caught by the compiler.

This will annoy people even more than they are already annoyed by 
the `@`-on-some-attributes-and-not-others inconsistency. The 
latter type (type 2 in my first thread) already exists in the 
language, but it shoudln't be replaced by another type. This 
argument was already made by Jonathan Davis.


More information about the Digitalmars-d mailing list