FAQ for newbies who see pure @safe nothrow @nogc

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 29 09:32:28 PST 2015


On 29/01/2015 15:54, Jonathan Marler wrote:
> Like this:
>
> abstract class MyClass { }
> @abstract void myfunc();
>
> See the inconsistency?  You're gonna end up with alot of these types of
> inconsistencies. In addition, you've made the rule of when to use the
> '@' symbol more complex.  Before it was, "Use '@' if it is not a
> keyword".  Now it's, "Use '@' if it is not a keyword except when it's a
> function attribute".  This definition will likely be made worse since
> people will want to solve the newly introduced inconsistencies.  So the
> new definition will become, "Use '@' if it is a keyword except if it's a
> function attribute or a class specifier".  By the time you solve every
> inconsistency you'll have made every usage of every keyword use the '@'
> symbol.  Then the rule will be "Always use the '@' symbol".

No, the idea proposed was:

@safe @override const func();
@abstract class C{}
const var = 5;
__gshared gvar = 4;

const is never @const. @abstract is always @abstract. It is variables 
that don't use @attribute syntax. This is not something I invented, it 
follows on from existing uses of @attributes and __keywords already 
supported by dmd.


More information about the Digitalmars-d mailing list