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

Jaden Geller jaden.geller at gmail.com
Tue Feb 21 06:48:18 CST 2017

> On Feb 21, 2017, at 4:44 AM, Alex Blewitt <alblue at apple.com> wrote:
>> On 21 Feb 2017, at 07:00, Jaden Geller via swift-evolution <swift-evolution at swift.org> wrote:
>> We avoid forcing users to organize code in such an opinionated manner just to please the compiler. Perhaps some submodules deserve a separate file, but I think that choice should not be forced by the language. I don’t have data on the popularity, but I personally very much dislike the similar restriction Java places on public classes and files.
> On the other hand, having such standardisation means that you know exactly where a type is based on its module membership. One of the outcomes of Scala's move away from enforcing a relationship between files and their module structure means that it is almost impossible to find where a type is defined using the filesystem, and you resort to using 'git grep' or other tools to find out where the implementation is located.
>> Given that we want Swift to be a fantastic scripting language, I feel we ought not place artificial restrictions on code organization. Many scripts are a single file (for convenience) but may still benefit from the organization modules offer.
> Is there a reason why a script should need to be in any module, as opposed to a top-level/unnamed module?

Submodules within a script provide encapsulation that can be useful for code organization. They likely would use an implicit (unnamed) outer module.

> Alex


More information about the swift-evolution mailing list