According to D docs (http://www.digitalmars.com/d/2.0/attribute.html#ProtectionAttribute) protected module members are illegal, but compiler allow me to do this.
module foo;
protected
{
int bar;
}
Is this error in docs, compiler bug or I am doing something wrong ?
Actually this is not the only inconsistency between documentation and reality, so is th开发者_StackOverflowis reference (http://www.digitalmars.com/d/2.0) are actual ? Is more actual language description exist somewhere ? My configuration: dmd 2.047, OS Windows 7, x86The compiler allows attributes in places where they don't have any effect. This is unfortunate, because it is confusing. Hopefully they will eventually be disallowed, like some of them already have.
The online documentation is not complete. If you're serious about learning D, you might want to buy the book "The D Programming Language" by Andrei Alexandrescu. It was released just a month ago. It covers some things that the online documentation doesn't. And vice versa.
You can find a lot of answers by searching the D newsgroup archives, or by asking in the newsgroup, searching the digitalmars site, the D wiki, etc. The docs themselves probably won't be updated for years, though.
精彩评论