A collection of DIPs
Brian Rogoff via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 8 09:09:00 PDT 2015
On Tuesday, 8 September 2015 at 03:09:20 UTC, Rikki Cattermole
wrote:
> On 08/09/15 5:27 AM, Shammah Chancellor wrote:
>> void main() {
>> import std.stdio : writeln;
>> writeln("Hello world!");
>> }
>>
>> -Shammah
>
> It's not just an idiomatic way to code with local imports, it's
> a compilation performance technique too.
I didn't read the DIP collection thoroughly (yup, D has a some
grotesqueries that would be nice to fix but I doubt will happen)
but local imports are one of the nice features of D (and Ada, and
OCaml) that I wish would be adopted in some other languages, like
Nim and Julia.
I never thought of them as a performance optimization though.
What's the reasoning? Are the observed differences significant?
From my POV restricting the scope of an import makes local
reasoning easier. I'd do it even if it were slightly less
performant!
More information about the Digitalmars-d
mailing list