:end to terminate attribute:

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 28 02:43:38 PDT 2016


Let's try this again.

This attribute block can be terminated by a corresponding 
protection attribute block:

// Begin private
private:
   void foo() {}

// End private
public:
    void bar() {}

But not all attributes have a corresponding attribute to turn 
them off:

// Begin @nogc
@nogc:
...

// End with scope/file

It would be a nice convenience to have something like this:

@nogc:

:end

Yes, I'm aware I could do this:

@nogc {}

But given the choice of : and {}, I'm tending to prefer the 
former these days. The lack of a way to turn off some attributes 
forces me to use {}. I recall discussions about something like 
@nogc(off) or some such. Was that ever approved? If not, I'd love 
to have something like :end, though I'm not attached to the name.


More information about the Digitalmars-d mailing list