Inline imports redivivus

Daniel N no at public.email
Tue Jul 27 13:08:25 UTC 2021


On Tuesday, 27 July 2021 at 12:34:58 UTC, Daniel N wrote:
> On Tuesday, 27 July 2021 at 09:20:25 UTC, Petar Kirov
>>> module(std.datetime).SysTime
>>
>> That's the best suggestion so far.
>
> 1) std.datetime::SysTime
> 2) module(std.datetime).SysTime
>
> From a human readability perspective I like option (1) the 
> best, however from a compiler perspective, you cannot tell that 
> LHS is a module until it sees the final ::(or some other 
> operator), that might not be optimal.
>
> Overall, I also think option 2 is the most realistic compromise.

There's one other interesting tradeoff to consider...

// This will not even stat the file, just inform the compiler 
that it's a module.
lazy import std.datetime;

// This is now unambigous - no need for special syntax
std.datetime.SysTime



More information about the Digitalmars-d mailing list