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.

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.

Best,
Jaden Geller  

> On Feb 20, 2017, at 10:51 PM, Jonathan Hull <[email protected]> wrote:
> 
> Part of it.  My concern is that the brackets will push everything in the file 
> to the right.
> 
> My question is: What do we get in return for that? (as opposed to a system 
> which acted on the whole file)
> 
> Thanks,
> Jon
> 
> 
>> On Feb 20, 2017, at 10:45 PM, Jaden Geller <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Oh, you’re referring to the fact that a submodule under this proposal must 
>> be contained within braces? It would be purely additive to, in the future, 
>> annotate that the outer scope of a file is part of some given submodule.
>> 
>> Consider the following the following straw-man syntax that might be 
>> equivalent to `module Bar { func foo() { } }`:
>> ```
>> module Bar follows // <- at top of file, indicating rest of file is submodule
>> 
>> func foo() { }
>> ```
>> 
>> Does this address your question?
>> 
>> Thanks,
>> Jaden Geller
>> 
>>> On Feb 20, 2017, at 10:39 PM, Jonathan Hull <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> 
>>>> On Feb 20, 2017, at 6:42 PM, Jaden Geller <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>> Jon,
>>>> 
>>>> I think we might have miscommunicated. It is intended that outermost 
>>>> module is implicit; no `module` declaration is required to wrap every 
>>>> file. We tried to show this in the first code snippet.
>>>> 
>>>> What do you mean “covering only part of a file”?
>>> 
>>> I am assuming that the ModuleName { … }  only affects things within the 
>>> brackets.  Thus it is possible for only part of a file to be within a 
>>> module.  What are the benefits of allowing this, and are they worth the 
>>> added complexity?
>>> 
>>> Thanks,
>>> Jon
>>> 
>>> 
>>>> Cheers,
>>>> Jaden Geller
>>>> 
>>>>> On Feb 20, 2017, at 6:36 PM, Jonathan Hull via swift-evolution 
>>>>> <[email protected] <mailto:[email protected]>> wrote:
>>>>> 
>>>>> What is the rational for having modules covering only part of a file?  
>>>>> Wouldn’t it be less clutter to have an annotation which worked for the 
>>>>> whole file.  At the very least it would be nice to have an option to 
>>>>> spell it in a way that applies to the whole file.  Otherwise, everything 
>>>>> will be indented another level.
>>>>> 
>>>>> I would honestly love to see something which just maps modules to 
>>>>> folders/groups for simplicity sake.
>>>>> 
>>>>> I haven’t thought about it too much yet, so I could easily be missing 
>>>>> something obvious...
>>>>> 
>>>>> Thanks,
>>>>> Jon
>>> 
>> 
> 

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to