Thoughts about modules
Derek Parnell
derek at psych.ward
Tue Jun 27 17:37:03 PDT 2006
On Wed, 28 Jun 2006 08:18:40 +1000, Andrei Khropov
<andkhropov at nospam_mtu-net.ru> wrote:
> Bruno Medeiros wrote:
>
>> I'm betting he means being able to import a module in a way that it's
>> names
>> (entities) are available only as fully-qualified names, and so the base
>> names
>> are not "imported" to the importing module namespace/scope. It's the FQN
>> import.
>>
>> Andrei, (and others) if you want to check out some previous discussion
>> on
>> this matter:
>> http://www.digitalmars.com/d/archives/digitalmars/D/28423.html
>
> Yes, you're right.
> But anyway, as far as I can see Walter's opinion is unknown.
> Is he satisfied with the present situation?
I believe so.
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
More information about the Digitalmars-d
mailing list