On Friday, 21 March 2014 at 08:05:09 UTC, monarch_dodra wrote:
On Friday, 21 March 2014 at 07:24:43 UTC, Steve Teale wrote:
Can someone tell me where this is written up?

Thanks
Steve

You mean generally, or in phobos?

The rational in phobos is that since it is heavily templated, it makes sense to pull the imports on a "as needed" basis.

If we placed all the imports needed *anywhere* in the module at the top, in *all* modules, then importing *anything* in std would import the world.

for example, something as "dumb" as TypeTuple:

=> need std.typetuple
=> pulls traits
=> pulls typecons and algorithm
=> pulls array, string, uni, ascii, utf, conv
=> pulls everything remaining

The new scheme allows massively reducing these dependencies. At least, that's the point. cross-module aliasing, and template constraints tend to make this as smooth as we'd like it.

In end user code, or in non-template code, there is less rational for doing this. At that point, it only becomes a style, issue, of whether or not you want to "pollute" your namespace with imported symbols.

OK, so what happens that's different when I pull in std.typetuple at the point where I need it? Does that avoid pulling in all the other stuff?

How does this problem manifest itself - code bloat, or slower compilations, or what?

Thanks
Steve

Reply via email to