DIP11

Steven Schveighoffer schveiguy at yahoo.com
Fri Aug 12 12:22:15 PDT 2011


On Fri, 12 Aug 2011 15:12:07 -0400, Jacob Carlborg <doob at me.com> wrote:

> On 2011-08-12 20:36, Steven Schveighoffer wrote:
>> On Fri, 12 Aug 2011 14:24:46 -0400, Jacob Carlborg <doob at me.com> wrote:
>>
>>> On 2011-08-12 15:49, Steven Schveighoffer wrote:
>>>> Note that the pragmas are specific to that file only. So you don't  
>>>> have
>>>> an import file which defines pragmas. This is to prevent conflicts
>>>> between two files that declare the same package override.
>>>
>>> Now I'm not quite sure I understand. Are you saying that every file
>>> needs to have these pragma imports ?
>>
>> Let's say file a.d pragmas that module foo means
>> http://foo.com/projectx, and module b.d from another project pragmas
>> that module foo means http://bar.com/projecty. If I import both a and b,
>> what happens?
>>
>> It only makes sense for a pragma to affect the current file.
>>
>> This is similar to how version=x statements only affect the current  
>> file.
>
> Again, will that mean you have to specify a pragma for each file?

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.

> 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


More information about the Digitalmars-d mailing list