phobos dependencies

Robert Schadek realburner at gmx.de
Tue Jan 7 03:12:10 PST 2014


On 12/21/2013 10:43 PM, Andrej Mitrovic wrote:
> The compiler matches the missing symbol with the selective import
> "writeln", so it knows it only has to load std.stdio, *but not*
> std.algorithm.
>
> Test-case 3:
> -----
> import std.stdio : writeln;
> import std.algorithm : map;
> import std.range;  // might be here (compiler doesn't know)
> import std.container;  // or here
>
> void main()
> {
>     "foo".front;
> }
> -----
>
> The compiler tries to find a selective import "front", but it doesn't
> find it. What's important here is that it still does not have to load
> std.stdio or std.algorithm, as we're explicitly loading only a set of
> symbols which were never referenced from the test.d module.
>
> So the next step here is for the compiler to try and load each module
> in sequence (probably via the declaration order, first std.container),
> and if there's a match the compiler would stop loading other modules
> (no need to load std.container if std.range has "front").
There is a flaw in that design. What if std.range and std.container both
have a matching .front? If you stop after the first you'll not find that
conflict. If you search both you'll not have any speed gain.



More information about the Digitalmars-d mailing list