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

Daniel Kozak via dmd-internals dmd-internals at puremagic.com
Mon Feb 22 08:08:27 PST 2016


It has been always error to use selective import with FQN. TDPL and
documentation says that. And it makes sense from my POV
Dne 22. 2. 2016 16:58 napsal uživatel "Jonathan M Davis via dmd-internals" <
dmd-internals at puremagic.com>:

> 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. They're there to avoid name
> conflicts when importing a module. But having a symbol be usable and yet
> not
> being able to use its FQN is just plain weird. Given what was said about
> the
> compiler implementation, I can understand why it would end up that way, but
> it's very unintuitive, and personally, it makes it so that I'm not
> particularly interested in using selective imports. I would not have
> expected a symbol to ever lose its FQN. It's not like it changes where it
> was declared based on how it was imported, much as the compiler
> implementation likes to act that way sometimes.
>
> - Jonathan M Davis
>
>
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-internals/attachments/20160222/360c1b78/attachment.html>


More information about the dmd-internals mailing list