[dmd-internals] Why are there suddenly tons of deprecation messages about imports in Phobos?

Steven Schveighoffer via dmd-internals dmd-internals at puremagic.com
Mon Feb 22 09:09:34 PST 2016


> On Feb 22, 2016, at 10:56 AM, Jonathan M Davis <newsgroup.d at jmdavisprog.com> wrote:
> 
> On Monday, February 22, 2016 09:59:31 Steven Schveighoffer via dmd-internals wrote:
>> 
>>> On Feb 22, 2016, at 7:04 AM, Jonathan M Davis via dmd-internals <dmd-internals at puremagic.com> wrote:
>>> 
>>> On Sunday, February 21, 2016 19:08:37 Steven Schveighoffer via dmd-internals wrote:
>>>> 
>>>> The key comment in those PRs: https://github.com/D-Programming-Language/dmd/pull/5426#issuecomment-181589047
>>> 
>>> Well, while I can see why from an implementation perspective, it makes sense
>>> to say that when you have
>>> 
>>> import foo.bar : baz;
>>> 
>>> you haven't really imported the module, so foo.bar.baz isn't legit, and you
>>> have to say baz, from a usability perspective, nobody is going to expect
>>> that foo.bar.baz suddenly is just baz and not foo.bar.baz, because you
>>> imported it with a selective imports.
>> 
>> Like the comment says, however, what if you have a local foo symbol defined? The compiler is going to complain, or silently choose one (I think with the new lookup rules, it would choose the local module’s name).
>> 
>> With Phobos, this isn’t strictly an issue, since we have no local symbols named std. But I could see lots of problems with other libraries.
> 
> In that case, using static imports makes sense.

I think you misunderstood the problem. If you have a local foo declared, then the FQN doesn’t help (as it starts with foo), you need to use a different name that doesn’t conflict, requiring either a renamed import, or using the leaf symbol name.

-Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-internals/attachments/20160222/e3a7765d/attachment-0001.html>


More information about the dmd-internals mailing list