Why the @ in @safe? & UDAs

Rob T alanb at ucora.com
Thu Nov 7 11:59:26 PST 2013


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.

The other thing I'd like to point out in terms of the hidden 
costs that inconsistencies create, is that these inconsistencies, 
and I refer to the ones that are not necessary and exist only for 
historical reasons and backwards compatibility, also have a 
negative effect on tool builders because there's more exceptions 
to the rule that the tools need to consider, and that will make 
tool building (to a degree) more difficult than necessary. One of 
the biggest weaknesses D has is a lack of tools, however D's 
inconsistencies are far less of an issue than some other 
languages with much better tool support, so it's not even close 
to a show stopper, it's just another irritation you have to put 
up with forever if historical inconsistencies are never resolved.

--rt


More information about the Digitalmars-d mailing list