A rationale for pure nothrow ---> @pure @nothrow (and nothing else changes)

Jonathan M Davis jmdavisProg at gmail.com
Sat Feb 27 13:43:51 PST 2010


Pelle Månsson wrote:
> Is there something wrong with this:
> 
> class A {
>    @private:
>      /* things */
>    @public:
>      /* public things */
> }
> 
> ..?
> 
> Seeing as the label-like syntax works today for, well, almost anything.
> Like this:
> 
> void main(string[] args) {
>      writeln(atoi("12"));
> }
> 
> extern (C):
> 
>      int atoi(const(char)* s);

Regardless of whether that would be a good idea or not, as it stands, 
attributes have to be on _something_. At the moment, in D, I think that 
they're restricted to functions. Labels aren't attributes and it makes no 
sense for them to be. And I don't see anything gained by making them use the 
same syntax as attributes. public and private are fine as they are. Changing 
the syntax of public and private labels would just increase porting 
headaches and increase D's learning curve for people who know C++.

- Jonathan M Davis



More information about the Digitalmars-d mailing list