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

Brent Royal-Gordon brent at architechies.com
Tue Feb 21 21:34:29 CST 2017


> 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