[swift-evolution] [Proposal][Discussion] Modular Swift

Robert Widmann devteam.codafi at gmail.com
Tue Feb 21 21:38:37 CST 2017


Correct.  Because, in dividing the submodule across an extension, you have placed what should be a private API into a differently-scoped location.

> On Feb 21, 2017, at 10:34 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> On Feb 21, 2017, at 7:14 PM, Robert Widmann <devteam.codafi at gmail.com> wrote:
>> 
>> Fileprivate and private are not changing at all.  Their meaning now extends from “private to this file” and “private to this declaration” respectively to those meanings plus “unexportable across any module boundary”.  One implication of this is it is now possible to create module-scoped private constants, functions, and data structures, which is one of the use-cases that Daniel Duan mentioned earlier down in the thread.
> 
> So what you are saying is that, in my example:
> 
> 	// foo.swift
> 	import MyMod.Submodule
> 	func foo() {
> 		bar()
> 	}
> 
> 	// bar.swift
> 	module Submodule {
> 		internal func bar() {
> 			baz()
> 		}
> 	}
> 
> 	// baz.swift
> 	extension Submodule {		
> 		??? func baz() {
>> 		}
> 	}
> 
> There is nothing I can put in the `???` slot that will expose `baz()` to `bar()`, but not to `foo()`. Correct?
> 
> -- 
> Brent Royal-Gordon
> Architechies
> 



More information about the swift-evolution mailing list