On Friday, 23 February 2018 at 13:38:25 UTC, Steven Schveighoffer wrote:
On 2/23/18 8:13 AM, jmh530 wrote:


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

I'm all about one import per line and would have had no plans to use the syntax myself. Just trying to grok it.

Reply via email to