Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 30, 2011 Why does std.string use public imports? | ||||
---|---|---|---|---|
| ||||
I'm referring to these two in std.string: public import std.algorithm : startsWith, endsWith, cmp, count; public import std.array : join, split; Because whenever I try to use .count in my code: import std.stdio; import std.string; import std.utf; void main() { writeln("foo".count); } std.utf.count conflicts with std.string's publicly imported std.algorithm.count Can we avoid public imports in modules? The rise of conflicts in Phobos is getting slightly annoying. |
June 30, 2011 Re: Why does std.string use public imports? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 01.07.2011 01:14, Andrej Mitrovic wrote:
> I'm referring to these two in std.string:
> public import std.algorithm : startsWith, endsWith, cmp, count;
> public import std.array : join, split;
>
> Because whenever I try to use .count in my code:
>
> import std.stdio;
> import std.string;
> import std.utf;
>
> void main()
> {
> writeln("foo".count);
> }
>
> std.utf.count conflicts with std.string's publicly imported std.algorithm.count
>
> Can we avoid public imports in modules? The rise of conflicts in
> Phobos is getting slightly annoying.
I cannot comment on the count issue, but if I was to import only std.string and I was missing basic functionality like the ones imported here, it would have annoyed me :) So it's good if it makes sense I think.
|
June 30, 2011 Re: Why does std.string use public imports? | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | That makes sense, I understand. But I hate these conflicts. I've got `alias std.bla.foo foo` scattered in most of my code due to constant conflicts. :/ |
July 01, 2011 Re: Why does std.string use public imports? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | Andrej Mitrovic Wrote:
> I'm referring to these two in std.string:
> public import std.algorithm : startsWith, endsWith, cmp, count;
> public import std.array : join, split;
I'm not sure why they are public, but selective/named imports have been publicly imported for some time. Bugzilla 3?? I think.
|
Copyright © 1999-2021 by the D Language Foundation