> On Dec 26, 2015, at 9:12 PM, Developer via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> I opened a radar a while ago about improving the import syntax in Swift and 
> haven’t received much of a response, so I’ll try to expand on my thoughts in 
> there here.
> 
> I’ve always been in love with the way Agda does Modules and imports.  The 
> syntax is wonderfully natural, and the features it provides are surprisingly 
> useful given their simplicity.  Because Swift forbids the redeclaration of 
> names between structs, enums, classes, and typealiases, I don’t believe that 
> the existing qualified import syntax is needed.  Therefore, I propose the 
> introduction of 3 agda-esque operations for imports to replace the usual 
> `import {func|typealias|struct|class|enum|etc.}` syntax:
> 
>       • import Foo using (bar, Baz, qux, corge, …)
>       • import Foo hiding (bar, baz, qux, corge, …)
>       • import Foo renaming (grault to garply, waldo to fred, …)
> 
> The first of these is used to introduce a limited set of identifiers into 
> scope, the second to import all but the given identifiers, and the third to 
> rename identifiers at the module level.  Again, it should be obvious by 
> uniqueness of identifiers what each one is referencing, so qualification of 
> each identifier is unnecessary.  If more context is needed, or more 
> granularity, a Haskell-esque 

+1 for this general direction, if not this specific syntax.  It would also be 
great to have import integrate with SPM so you can import a package from an SCM 
URL.  This would be pretty handy in particular for #! scripts.

-Chris
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to