Pseudo namespaces

tcak via Digitalmars-d digitalmars-d at puremagic.com
Fri Dec 4 12:58:02 PST 2015


On Friday, 4 December 2015 at 09:30:08 UTC, Walter Bright wrote:
> On 12/4/2015 12:48 AM, Dicebot wrote:
>> True, that didn't come to my mind. But that pushes resulting 
>> coding style from
>> "weird but tolerable" to "good luck explaining newbies why D 
>> modules are not
>> broken". All for the sake of a putting a dot in the name. Look 
>> at perspective
>> for a moment think if you would be happy to use a language 
>> which avdertises such
>> approach as idiomatic (for one of most basic language 
>> operations).
>
> I don't understand your comment that modules are broken. With 
> imports, you can use the module name as a prefix or not.

The problem with using modules at this point is, as I come to same
conclusion, that it forces name repetitions. Example I am defining
many APIs right now for database operations. File is over thousand
of lines, and each API is used for separate operations. I can 
create
a separate module for each API to decrease complexity, but than
both the name of module and name of API function are almost same
thing. And, as it is very clearly seen in Phobos as well, many
names are repeated again and again which creates ugly code. I even
cannot propose any solution to this other then following the long
way: using package.d to alias same function in both module and 
package
which feels hackish.

Andrei is, I guess, following that approach to prevent this as 
well.


More information about the Digitalmars-d mailing list