coding practices: include whole module or only the needed function

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 7 12:38:52 PDT 2014


On Tuesday, 7 October 2014 at 17:29:45 UTC, ketmar via 
Digitalmars-d-learn wrote:
> On Tue, 07 Oct 2014 17:24:40 +0000
> bachmeier via Digitalmars-d-learn 
> <digitalmars-d-learn at puremagic.com>
> wrote:
>
>> On Tuesday, 7 October 2014 at 08:37:59 UTC, monarch_dodra 
>> wrote:
>> > As a general rule, avoid imports in global scope anyways.
>> Can you expand or provide a link to the issue?
> ahem...
> https://issues.dlang.org/show_bug.cgi?id=313
> https://issues.dlang.org/show_bug.cgi?id=314

That's only relative to having selective imports.

The idea of avoiding global imports is mostly to avoid polluting 
your own namespace, or to keep better track of who needs what.

For example, if 1 function requires "std.foo", and then you later 
remove that function. With global imports, chances are you'll 
forget to remove it.


More information about the Digitalmars-d-learn mailing list