May 21, 2021

On Thursday, 20 May 2021 at 15:25:58 UTC, Petar Kirov [ZombineDev] wrote:

>

No, we should improve the build times of import std, until it performs better than your proposed version of import std.essentials :P
This will not solve the problem with surprise imports.

May 22, 2021

On Friday, 21 May 2021 at 06:31:53 UTC, Ogi wrote:

>

On Thursday, 20 May 2021 at 15:25:58 UTC, Petar Kirov [ZombineDev] wrote:

>

No, we should improve the build times of import std, until it performs better than your proposed version of import std.essentials :P
This will not solve the problem with surprise imports.

That's a good point, though this is a general problem with non-selective imports of large modules / packages and not specific to std. My guess is that import vibe.d; / import vibe.vibe; exhibits a similar problems.

IMO, certain symbols (like the aforementioned std.compiler.name) are only meant to be available via static imports.
Which brings me to the question: why does static import std; not work? I logged issue 21943. This prevents all possible accidental name collisions with non-static imports. Also it should make compilation faster, since the compiler knows the exact file name where to search for the given symbol, similar to the self-important lookup idiom.
Anyway, I would expect that we can mark certain public imports in the std package as static (e.g. this one), which should make them available only through their FQN. Also static import std.stdio : writeln; should work by allowing to use writeln directly while File only via FQN - std.stdio.File.

Said all that, I think std.essentials is a good idea! (I'm just against deprecating std, as it is a sound feature, which the language and Phobos should fully support.)
We should provide an opinionated selection of the most commonly used Phobos modules, that also best represent the language (e.g. not things like std.demangle, std.signals, std.system which are unlikely to be used often). After checking your list again, the only change I would do is to add std.{json,file,path,process,sumtype} and std.parallelism : parallel, as these are things I use in almost every script.

1 2
Next ›   Last »