is "import std;" a valid approach or a violation of the D programming language?

Joakim Brännström notfornow at dev.null.com
Sat May 15 16:50:07 UTC 2021


On Saturday, 15 May 2021 at 13:59:15 UTC, Witold Baryluk wrote:
> I think `import std;` shouldn't be used for scripting. It just 
> makes startup longer (which is important for scripts), and 
> makes you vulnerable to future conflicts with new symbols in 
> Phobos, which is a reality in anything other than most trivial 
> scripts. Sure, it is a good start in rush to start with off, 
> but nothing more.

I love it for scripting. `import std;` and start solving the 
problem.
If startup is a concern I precompile the *script* :)

Then later on if the script ever need to grow to a *real* program 
it is refactoring time and replace `import std;` with what is 
used.

// Joakim B.


More information about the Digitalmars-d mailing list