Inline imports redivivus
Daniel N
no at public.email
Sun Aug 1 16:03:05 UTC 2021
On Sunday, 1 August 2021 at 13:30:55 UTC, Paul Backus wrote:
> On Sunday, 1 August 2021 at 04:15:33 UTC, Vladimir Panteleev
> wrote:
>>
>> (import std.datetime).SysTime
>>
>> In an expression, import currently can only appear followed by
>> '(', so there is no ambiguity.
>
> Very elegant; I like it.
It looks reasonable when it appears as a simple statement, but as
soon as it's in an expression... it doesn't compose as well.
it will result in ubiquitous double parens.
if ((import std.datetime).SysTime > deadline)
-> **
Compare with one of the other competing suggestions
if (module(std.datetime).SysTime > deadline)
The design of D helped alot to cut down the amount of parens...
if you are not convinced, consider how much UFCS and single
argument templates helped human readability.
More information about the Digitalmars-d
mailing list