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

Pelle Månsson pelle.mansson at gmail.com
Sat Feb 27 12:21:32 PST 2010


On 02/27/2010 08:18 PM, Jonathan M Davis wrote:
> Oh, it's far worse than that. In C++, public and private are labels. They
> don't go on each individual function. You'd probably have to parse the code
> to correctly, automatically manipulate the labels into attributes. And D
> supports public and private as labels in addition to going on each function,
> so you'd have the problem with both C++ and D code. What you suggest would
> work for Java, and I'm pretty sure that it works for C# (it's been a while
> since I've coded in it though, so I don't recall for certain which way they
> use public and private), but for C++, D1, and older D2 code, it wouldn't
> work.
>
> So, unless the suggestion is that public and private be allowed as labels,
> and then when they're used on functions, they're now attributes, then simple
> text replacement doesn't work. And I really think that leaving them as
> labels and having them as attributes on functions would make the two uses
> too different.
>
> Besides, I see no gain in making public and private attributes. They're
> already keywords, if you leave them as labels, they have to remain keywords,
> so I see no gain in making them attributes. It just makes porting code
> harder.
>
> - Jonathan M Davis

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);



More information about the Digitalmars-d mailing list