DIP11

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 15 06:11:51 PDT 2011


On Sat, 13 Aug 2011 08:24:53 -0400, Jacob Carlborg <doob at me.com> wrote:

> On 2011-08-12 21:22, Steven Schveighoffer wrote:
>
>> Yes, or specify it on the command line/config file. I think the risk of
>> inadvertently importing incorrect files is too great.
>>
>> Looking back at it, however, we probably would need some mechanism for
>> files in the same package to inherit the source location.
>>
>> For example, if you pragma that a module foo = http://foo.com/projectx,
>> and import foo.xyz, and foo.xyz imports foo.abc, we don't want foo.xyz
>> to have to pragma the same url just to include another file in its own
>> package.
>>
>> Clearly we need some more thought around this.
>
> Yeah, that's what I was afraid of.
>
>>> Just for the record, you cannot always solve all dependencies, it can
>>> happen that two packages conflict with each other.
>>
>> As long as the dependencies are contained, there should be no conflict.
>> If I can compile project x and y separately, and both have a conflicting
>> dependency, then I should still be able to compile a project that
>> depends on both x and y, as long as they don't import eachother.
>>
>> -Steve
>
> If x and y depends on two different versions of z, how would that be  
> solved. As far as I know you cannot link the same library of two  
> different version twice, you will get conflicting symbols.

It wouldn't be an actual conflict, it would be a naming issue.  In other  
words, I'm not talking about two different versions of the same library.   
That has to be a compiler error.

What could happen though, is this situation:

a.d pragma's foo.bar as being http://somedreposiotry.com/foo/barv1.0
b.d includes the repository path http://somedrepository.com, whose default  
foo.bar goes to foo/barv2.0, but b does not depend on foo.bar

I don't think a.d's pragma should include b's pragma, or vice versa.   
Especially if it is some sort of weird import order precedent.

It's just much simpler to say "b's pragma only affects b, and a's pragma  
only affects a."  However, I think we need to add that any files imported  
via a pragma implicitly include that path.  I should probably add that to  
the DIP.

Obviously if a.d depends on foo.bar, and b.d depends on foo.bar, but the  
locations are different, it should be a compiler error.

-Steve


More information about the Digitalmars-d mailing list