Why the @ in @safe? & UDAs

QAston qaston at gmail.com
Fri Nov 8 00:57:59 PST 2013


On Thursday, 7 November 2013 at 19:59:28 UTC, Rob T wrote:
> On Thursday, 7 November 2013 at 15:55:47 UTC, Jonathan M Davis 
> wrote:
> [..]
>> Then should public and private be @public and @private in 
>> order to be
>> consistent? Then we'd be inconsistent with C++, Java, C# etc. 
>> which would make
>> it that much harder for folks to learn D. Would you want 
>> @static and @const?
>>
>> I don't think that you can be 100% consistent. If nothing 
>> else, as soon as you
>> make one thing consistent, it often ends up being inconsistent 
>> with something
>> else. And sometimes consistency costs us. For instance, this 
>> is perfectly
>> legal
>>
> [...]
>
> Very good points. It's a balancing act for sure.
>
> The other inconsistencies are having multiple ways of doing the 
> same things
>
> Example
>
> 1) private { }
> 2) private:
> 3) private foo() { ... }
>
> That's more to learn and more to document and different methods 
> may confuse people new to D unless they are already 
> preconditioned to it coming from a language like C++, however 
> sometimes having these options are nice and do serve a useful 
> purpose, although in the example 1 and 2 are redundant and 2 
> goes against the usual {} scope  concept, which is very unusual 
> in terms of consistency.
>
> --rt

I like that I don't have to repeat private with every declaration.


More information about the Digitalmars-d mailing list