is "import std;" a valid approach or a violation of the D programming language?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat May 15 16:11:35 UTC 2021
On 5/15/21 9:59 AM, 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.
One reason why import std is expensive is that it instantiates a bunch
of templates (even if not used). That can be seen with -vtemplates:
https://run.dlang.io/is/MT6hvE
I think we can improve on that.
More information about the Digitalmars-d
mailing list