[swift-evolution] [Proposal][Discussion] Qualified Imports

Robert Widmann rwidmann at apple.com
Thu Jul 21 02:46:59 CDT 2016


~Robert Widmann

2016/07/21 0:34、Pyry Jahkola <pyry.jahkola at iki.fi> のメッセージ:

> 
>> On 21 Jul 2016, at 10:29, Robert Widmann <devteam.codafi at gmail.com> wrote:
>> 
>> This proposal is specifically source breaking because we're only trying to deprecate and remove
>> 
>> import {class|func|struct|...} Module.Entity
>> 
>> -style imports (which not too many people seem to know actually exist).
> 
> That's a worthy goal. But do we need to offer and implement the alternative? Could we not live without that syntax while we nail down the better import syntax?

I have nailed down this syntax.  People are bikeshedding (as is their right) and nobody has come up with something they've been wiling to defend yet.  I chose this syntax knowing full well other languages with these features would come up, knowing that there would be future extensions, and knowing there would be strong interactions with the current module system.  These have been fleshed out now and are not the primary focus of this proposal - we will discuss modules when the time comes for that proposal.

We just want to replace this syntax with something better.  Something people can build out from in Swift 10 if they like.  As now, there is nothing stopping you from adding more import directives - trust me, we tried.  Sticking with a Scala-esque syntax means we're stuck defining strange non-extensible variations on tuple members, Python's means ambiguity, and Java's implies we have a fully functioning module system.

> 
> I've used the explicit import syntax a few times to make it clear what I'm importing, but I wouldn't really miss it if it got removed in Swift 3, and an alternative was added back in Swift 3.1.

It's an interesting idea.  But if I can have my cake and eat it too

> 
> ― Pyry
> 


More information about the swift-evolution mailing list