is "import std;" a valid approach or a violation of the D programming language?
Max Haughton
maxhaton at gmail.com
Sat May 15 16:16:37 UTC 2021
On Saturday, 15 May 2021 at 16:11:35 UTC, Andrei Alexandrescu
wrote:
> 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.
If anything ever comes of it, the thing Stefan is playing around
with (Tasks/Making dmd aware of dependencies inside itself) could
make PAYG a science rather than a hack in future - i.e. do more
work to understand where you can do nothing instead.
More information about the Digitalmars-d
mailing list