<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span></span></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>Maybe that's why we should introduce the addition of 'Main.swift' before the Swift Package Manager (and Swift 3.0) hits stable?</div><div><br></div><div id="AppleMailSignature">I've never requested to drop 'main.swift'. I merely prefer the additional support for 'Main.swift'. Library/Frameworks should not have 'Main.swift' imho as it leads to further confusion.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">If the compiler and Xcode team find this too difficult <i>to add support fo</i>r and not for any other reasons, I'd be okay with sticking with 'main.swift'. Just find it odd for reasons specified throughout this email thread.</div><div><br>On May 2, 2016, at 10:20, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div class="">My concern is not about people who have both main.swift and Main.swift; it's people who have libraries/frameworks (no main.swift) where one of the source files happens to be named Main.swift. This isn't likely, but it is possible.</div><div class=""><br class=""></div><div class="">We're certainly not going to drop "main.swift" in favor of "Main.swift", so the question would just be if we wanted to add "Main.swift". And I don't think we want different rules for Xcode and the package manager, especially not when the package manager can generate simple Xcode projects.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 2, 2016, at 10:09, Natthan Leong &lt;<a href="mailto:kar.joon@icloud.com" class="">kar.joon@icloud.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">Isn't it odd to have both main.swift and Main.swift for a project?</div><div class=""><br class=""></div><div class="">Considering Swift 3 provides source breaking changes, can this be still worth an side effort to pursue with the compiler team as advised by Kostiantyn in the bug report? <span style="background-color: rgba(255, 255, 255, 0);" class="">If so, how'd I approach them regarding this?</span></div><div class=""><br class=""></div><div class="">Isn't the Swift Package Manager a (new) tool in handling Swift code? Is this really the case where a minor change/addition to a convention is so difficult that it shouldn't be done? Can't Xcode support only either Main.swift or main.swift in the future?</div><div class=""><br class=""></div><div class="">The bug report is linked here</div><div class=""><a href="https://bugs.swift.org/browse/SR-1379" class="">https://bugs.swift.org/browse/SR-1379</a></div><div class=""><br class=""></div><div class=""><div class=""></div>On May 2, 2016, at 09:34, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class="">[+swift-dev, bcc swift-users] I’d be fine with supporting “Main.swift”. The one downside is that it could change behavior for existing projects relying on “Main.swift” being a library file, and that might mean it’s not worth making a change.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 1, 2016, at 23:34, Kostiantyn Koval via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div 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&nbsp;</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>
&gt; Hi there,<br class="">&gt; <br class="">&gt; This is what happened as I was trying out the Swift Package Manager for another project similar to the one shown below:<br class="">&gt; <br class="">&gt; ~ $ mkdir example<br class="">&gt; ~ $ cd example/<br class="">&gt; example $ touch Package.swift<br class="">&gt; example $ mkdir Sources<br class="">&gt; <br class="">&gt; example $ vi Sources/Example.swift<br class="">&gt; example $ cat Sources/Example.swift<br class="">&gt; func printOther() {<br class="">&gt; print("other")<br class="">&gt; }<br class="">&gt; <br class="">&gt; example $ vi Sources/Main.swift<br class="">&gt; example $ cat Sources/Main.swift<br class="">&gt; print("Hello World")<br class="">&gt; printOther()<br class="">&gt; <br class="">&gt; <br class="">&gt; example $ swift build<br class="">&gt; Compile Swift Module 'example' (2 sources)<br class="">&gt; /PATH/example/Sources/Main.swift:1:1: error: expressions are not allowed at the top level<br class="">&gt; print("Hello World")<br class="">&gt; ^<br class="">&gt; /PATH/example/Sources/Main.swift:2:1: error: expressions are not allowed at the top level<br class="">&gt; printOther()<br class="">&gt; ^<br class="">&gt; /PATH/example/Sources/Main.swift:1:1: error: expressions are not allowed at the top level<br class="">&gt; print("Hello World")<br class="">&gt; ^<br class="">&gt; /PATH/example/Sources/Main.swift:2:1: error: expressions are not allowed at the top level<br class="">&gt; printOther()<br class="">&gt; ^<br class="">&gt; &lt;unknown&gt;:0: error: build had 1 command failures<br class="">&gt; error: exit(1): /PATH-SWIFT/usr/bin/swift-build-tool -f /PATH/example/.build/debug.yaml<br class="">&gt; <br class="">&gt; <br class="">&gt; example $ mv Sources/Main.swift Sources/main.swift<br class="">&gt; example $ swift build<br class="">&gt; Compile Swift Module 'example' (2 sources)<br class="">&gt; Linking .build/debug/example<br class="">&gt; example $ .build/debug/example<br class="">&gt; Hello World<br class="">&gt; other<br class="">&gt; example $<br class="">&gt; <br class="">&gt; <br class="">&gt; 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="">&gt; <br class="">&gt; 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="">&gt; <br class="">&gt; 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="">&gt; <br class="">&gt; Or maybe I’m just being pedantic?<br class="">&gt; <br class="">&gt; p.s. evenPackage.swiftis capitalized and notpackage.swift<br class="">&gt; <br class="">&gt; $ swift --version<br class="">&gt; Swift version 3.0-dev (LLVM 752e1430fc, Clang 1e6cba3ce3, Swift 56052cfe61)<br class="">&gt; Target: x86_64-unknown-linux-gnu<br class="">&gt; <br class="">&gt; <br class="">&gt; <br class="">&gt; <br class="">&gt;<span class="Apple-converted-space">&nbsp;</span>

</div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></blockquote></div></body></html>