static import (v2.071.0)

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 11 07:32:18 PDT 2016


On Wednesday, 11 May 2016 at 14:28:00 UTC, Vladimir Panteleev 
wrote:
> On Wednesday, 11 May 2016 at 14:26:37 UTC, Vladimir Panteleev 
> wrote:
>> On Wednesday, 11 May 2016 at 14:24:03 UTC, Chris wrote:
>>> I was wondering if
>>>
>>> `static import std.file;`
>>>
>>> `if (exists(file))`
>>>
>>> will only import `std.file.exists` or the whole lot of 
>>> `std.file`? I want to find out what the best strategy for 
>>> imports is now.
>>
>> Modules are always imported wholesale as far as code 
>> generation / linking is concerned.
>
> To elaborate - this doesn't imply that the code of everything 
> in that module will always be placed in the executable. The 
> exact details depend on the implementation and configuration 
> (see e.g. GCC's -ffunction-sections).

Hm. What's the point then of using

import std.string : strip;

as opposed to

static import std.string;

std.string.strip();


More information about the Digitalmars-d-learn mailing list