May 15, 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.
May 15, 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.
May 15, 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.

1 2
Next ›   Last »