Jump to page: 1 2
Thread overview
private selective imports
Aug 06, 2014
Vlad Levenfeld
Aug 06, 2014
H. S. Teoh
Aug 06, 2014
Dicebot
Aug 06, 2014
sigod
Aug 06, 2014
Gary Willoughby
Aug 06, 2014
Vlad Levenfeld
Aug 06, 2014
Jonathan M Davis
Aug 06, 2014
Dicebot
Aug 06, 2014
Jonathan M Davis
Aug 06, 2014
Vlad Levenfeld
Aug 06, 2014
H. S. Teoh
Aug 06, 2014
Dicebot
Aug 06, 2014
H. S. Teoh
August 06, 2014
Is there any way to make selective imports private? I've got a name clash from importing an "all" module that has a bunch of public imports, one of which is circular, it goes sort of like this:

module math.all;

public:
import geometry;
import vectors;

---

module vectors;

struct Vector {}

---

module geometry;

import math.all: Vector;

And then I get an error like: vectors.Vector conflicts with geometry.Vector

Its the same Vector, though. What can I do?
August 06, 2014
On Wed, Aug 06, 2014 at 06:19:34PM +0000, Vlad Levenfeld via Digitalmars-d-learn wrote:
> Is there any way to make selective imports private? I've got a name clash from importing an "all" module that has a bunch of public imports, one of which is circular, it goes sort of like this:
> 
> module math.all;
> 
> public:
> import geometry;
> import vectors;
> 
> ---
> 
> module vectors;
> 
> struct Vector {}
> 
> ---
> 
> module geometry;
> 
> import math.all: Vector;
> 
> And then I get an error like: vectors.Vector conflicts with geometry.Vector
> 
> Its the same Vector, though. What can I do?

I'd file a bug.

But obviously, you want a workaround in the meantime. I'll leave it to the module experts to answer that. ;-)  (My module structures tend to be quite shallow and simple, so I haven't run into this problem myself yet.)


T

-- 
If you want to solve a problem, you need to address its root cause, not just its symptoms. Otherwise it's like treating cancer with Tylenol...
August 06, 2014
Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314
August 06, 2014
On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
> Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314

+1 vote from me.
August 06, 2014
On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
> Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314

Yeah this is a famous bug that seems to catch everyone out at some stage.
August 06, 2014
On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
> Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314

+1 from me as well.

This is unfortunate. D otherwise has a very comfortable import system.
August 06, 2014
On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
> Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314

Yeah, it's why I'd suggest that folks not use selective imports right now. But people seem to really love the feature, so they use it and keep running into this problem.

- Jonathan M Davis
August 06, 2014
On Wednesday, 6 August 2014 at 19:31:04 UTC, Jonathan M Davis wrote:
> On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
>> Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314
>
> Yeah, it's why I'd suggest that folks not use selective imports right now. But people seem to really love the feature, so they use it and keep running into this problem.
>
> - Jonathan M Davis

scope-local selective imports are not affected
August 06, 2014
On Wednesday, 6 August 2014 at 19:35:02 UTC, Dicebot wrote:
> On Wednesday, 6 August 2014 at 19:31:04 UTC, Jonathan M Davis wrote:
>> On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
>>> Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314
>>
>> Yeah, it's why I'd suggest that folks not use selective imports right now. But people seem to really love the feature, so they use it and keep running into this problem.
>>
>> - Jonathan M Davis
>
> scope-local selective imports are not affected

Sure, but people keep using them at the module-level, which really shouldn't be done until the bug is fixed. IMHO, we'd be better off making it illegal to use selective imports at the module-level rather than keeping it as-is.

- Jonathan M Davis
August 06, 2014
> Sure, but people keep using them at the module-level, which really shouldn't be done until the bug is fixed. IMHO, we'd be better off making it illegal to use selective imports at the module-level rather than keeping it as-is.
>
> - Jonathan M Davis

I'm curious, what's the problem with it anyway? Judging by the posts in the bug report and the bug's own lifespan this must be a real tough one to crack.
« First   ‹ Prev
1 2