<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi there,</div><div class=""><br class=""></div><div class=""><b class="">main </b>is common used naming for executables that contains main function. It’s required by Swift compiler and Swift Package Manager can’t do anything about that.</div><div class="">If you create a simple command line tool in Xcode, it will create <b class="">main.swift</b> file. If you try to rename it, it will feil.</div><div class="">I think this is correct behaviour.</div><div class="">If you still think that Swift should support <b class="">Main.swift </b>with upper case letter, than it should be discussed with compiler team.</div><div class=""><br class=""></div><div class="">- Kostiantyn</div><div class=""><br class=""></div>
> Hi there,<br class="">> <br class="">> This is what happened as I was trying out the Swift Package Manager for another project similar to the one shown below:<br class="">> <br class="">> ~ $ mkdir example<br class="">> ~ $ cd example/<br class="">> example $ touch Package.swift<br class="">> example $ mkdir Sources<br class="">> <br class="">> example $ vi Sources/Example.swift<br class="">> example $ cat Sources/Example.swift<br class="">> func printOther() {<br class="">> print("other")<br class="">> }<br class="">> <br class="">> example $ vi Sources/Main.swift<br class="">> example $ cat Sources/Main.swift<br class="">> print("Hello World")<br class="">> printOther()<br class="">> <br class="">> <br class="">> example $ swift build<br class="">> Compile Swift Module 'example' (2 sources)<br class="">> /PATH/example/Sources/Main.swift:1:1: error: expressions are not allowed at the top level<br class="">> print("Hello World")<br class="">> ^<br class="">> /PATH/example/Sources/Main.swift:2:1: error: expressions are not allowed at the top level<br class="">> printOther()<br class="">> ^<br class="">> /PATH/example/Sources/Main.swift:1:1: error: expressions are not allowed at the top level<br class="">> print("Hello World")<br class="">> ^<br class="">> /PATH/example/Sources/Main.swift:2:1: error: expressions are not allowed at the top level<br class="">> printOther()<br class="">> ^<br class="">> <unknown>:0: error: build had 1 command failures<br class="">> error: exit(1): /PATH-SWIFT/usr/bin/swift-build-tool -f /PATH/example/.build/debug.yaml<br class="">> <br class="">> <br class="">> example $ mv Sources/Main.swift Sources/main.swift<br class="">> example $ swift build<br class="">> Compile Swift Module 'example' (2 sources)<br class="">> Linking .build/debug/example<br class="">> example $ .build/debug/example<br class="">> Hello World<br class="">> other<br class="">> example $<br class="">> <br class="">> <br class="">> I had to renameMain.swifttomain.swift. Is there a design decision on why the filename for the main swift file has to be lowercase or is this a bug?<br class="">> <br class="">> If it’s a design decision, why are directory names forsource files allowed to have variations likeSources,Source,srcandsrcsas statedhere(<a href="https://github.com/apple/swift-package-manager/blob/master/Documentation/SourceLayouts.md#other-rules" class="">https://github.com/apple/swift-package-manager/blob/master/Documentation/SourceLayouts.md#other-rules</a>)but not the main swift file?<br class="">> <br class="">> I’d be ok if onlyMain.swiftandmain.swiftare allowed since other files in theSourcesdirectory are commonly UpperCamelCasedue to the Type naming conventions e.g.example-package-playingcard/Sources(<a href="https://github.com/apple/example-package-playingcard/tree/master/Sources" class="">https://github.com/apple/example-package-playingcard/tree/master/Sources</a>).<br class="">> <br class="">> Or maybe I’m just being pedantic?<br class="">> <br class="">> p.s. evenPackage.swiftis capitalized and notpackage.swift<br class="">> <br class="">> $ swift --version<br class="">> Swift version 3.0-dev (LLVM 752e1430fc, Clang 1e6cba3ce3, Swift 56052cfe61)<br class="">> Target: x86_64-unknown-linux-gnu<br class="">> <br class="">> <br class="">> <br class="">> <br class="">><span class="Apple-converted-space"> </span>
</body></html>