Thoughts about modules

kris foo at bar.com
Thu Jun 29 13:35:53 PDT 2006


Sjoerd van Leent wrote:
>> The curent situation is a syntax shortcut. No one is prevented from 
>> using FQN syntax, and in fact I try to use that form in my code, with 
>> the main exception being 'writefln' of course ;-)
>>
>> The benefit I can see from the shortcut form is that one can change 
>> modules without having to change references to members in that module, 
>> whereas with FQN usage one has to do a global find/replace over all 
>> your source code.
>>
>> The cost of not using FQN though is it does not keep well over time in 
>> terms of reading the code and have an understanding of it. Plus you 
>> can get caught out sometimes when introducing another import that 
>> causes name clashes.
>>
>> I'm not an advocate of either style of coding and I won't dictate to 
>> others either on this matter. I have a preference, as my fellow coders 
>> also have a preference, which may be different, and I'm okay with that.
>>
>> Why do you think that FQN syntax is demonstrable better than the 
>> current shortcut syntax?
>>
>> --Derek Parnell
>> Melbourne, Australia
> 
> 
> The thing I'd see useful here would be:
> 
> import fb : foo.bar;
> 
> Indicates all methods from module "foo.bar" are in local namespace "fb"
> 
> import $ : foo.bar;
> 
> Would be the same as
> 
> import foo.bar : foo.bar;
> 
> Regards,
> Sjoerd


or perhaps import x.y.z as foo;

Where the "as <name>" is optional






More information about the Digitalmars-d mailing list