Lazy private selective imports
Peter Alexander
peter.alexander.au at gmail.com
Tue Mar 25 16:27:21 PDT 2014
On Tuesday, 25 March 2014 at 22:44:30 UTC, Martin Nowak wrote:
> On 03/24/2014 10:18 PM, Peter Alexander wrote:
>> Would it be possible to perform private selective imports
>> lazily? i.e.
>> only import when the symbol selectively imported is requested.
>>
> Laziness only makes sense for static imports, because otherwise
> the compiler needs to check for overloads during symbol lookup.
If I only import writeln from std.stdio then you only overload
resolution that could effect is that of the symbol writeln. That
means you only need to process the import when writeln is
encountered. No?
e.g.
import std.stdio : writeln;
void main() { foo(); }
There should be no need to look in std.stdio at all here,
regardless of whether it contains foo or not because I'm only
importing writeln.
More information about the Digitalmars-d
mailing list