Accessing class with module name as Java's

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 12 21:18:44 PST 2015


On 01/12/2015 08:22 PM, tcak wrote:
 >> What namespace? D has modules, unlike C++. In general it's a bad idea
 >> to have inside a module a name (like a variable name or struct name)
 >> equal to the module name, because it causes confusion.
 >
 > I am confused as well.
 >
 > core.stdc.errno
 >
 > @property int errno() { return getErrno(); }
 > @property int errno(int n) { return setErrno(n); }

errno better worked similar to what it represents ("the" errno) so I am 
not surprised that it has the same name as its module. It is like how 
errno.h defines errno in C.

Like bearophile though, I don't understand the namespace issue. Can you 
explain it with a piece of code please.

Ali



More information about the Digitalmars-d-learn mailing list