How do I defeat the gratuitous qualification of alias members?

Chad Joan chadjoan at gmail.com
Fri Apr 5 09:48:04 PDT 2013


On 04/05/2013 06:30 AM, bearophile wrote:
> Chad Joan:
>
>> It's always bugged me that D enums seem to prevent the separation of
>> two distinct enum features:
>> - Type safety.
>> - Forced name qualification.
>>
>> Usually I find the former incredibly useful and the latter to be a
>> hindrance. It's very inconsistent with how module scoping works:
>> module qualification is not required unless there is an ambiguity. I
>> wish enums worked the same way.
>
> I'd like modules to require qualifications on default, just like in
> Python :-)
>
> Bye,
> bearophile

Hmmm, I don't remember python doing this.  Do you mean like Java?

So I would have to write code like this:
---
import std.file, std.array, std.stdio;

void main()
{
     std.stdio.writeln(
         std.array.replace(
             cast(string)std.file.read("file.txt"),"\r\n","\n"));
}
---
instead of code like this:
---
import std.file, std.array, std.stdio;

void main()
{
     writeln(replace(cast(string)read("file.txt"),"\r\n","\n"));
}
---
???




More information about the Digitalmars-d-learn mailing list