Beta 2.079.0

Steven Schveighoffer schveiguy at yahoo.com
Fri Feb 23 13:38:25 UTC 2018


On 2/23/18 8:13 AM, jmh530 wrote:
> On Friday, 23 February 2018 at 11:57:05 UTC, Martin Nowak wrote:
>>
>> A newcomer to D could rightfully conclude that comma is a module 
>> separator and the following is the correct syntax to import multiple 
>> symbols.
>>
>>     import std.stdio, std.conv : to, std.conv : parse;
>>
> 
> What if you have something like
> import std.stdio, std.conv : to, parse;
> and there is a module at the top-level named parse?

Then you have to import it on a separate line, or import it first.

It's why I put one import per line. It's second nature to me, I don't 
even think of putting imports on the same line.

But I think the better solution to this is instead making imports that 
collect other imports together. For instance, I rarely import 
std.algorithm.X, I usually use std.algorithm, even for selective 
imports. That seems more natural, and I don't have to look up which 
submodule it's in.

-Steve


More information about the Digitalmars-d-announce mailing list