Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 06, 2014 private selective imports | ||||
---|---|---|---|---|
| ||||
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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vlad Levenfeld | 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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vlad Levenfeld | Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314 |
August 06, 2014 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | 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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | 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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | 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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | 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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | 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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | 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 Re: private selective imports | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | > 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.
|
Copyright © 1999-2021 by the D Language Foundation