<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">This does exist right now BTW: <a href="https://github.com/RubyNative/Diamond">https://github.com/RubyNative/Diamond</a></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><br><div><div style="color:rgb(0,0,0);font-family:Helvetica;margin:0px"> -- </div><div style="color:rgb(0,0,0);font-family:Helvetica;margin:0px"><span style="color:rgb(35,35,35);font-size:12px">[</span><span style="font-family:verdana,arial,helvetica,code2000,sans-serif;font-size:small">·</span><span style="color:rgb(35,35,35);font-size:12px">/ ]</span><span style="color:rgb(35,35,35);font-size:12px;white-space:pre">        </span>      <span style="color:rgb(35,35,35);font-size:12px">Orta Therox</span></div><div style="font-family:Helvetica;font-size:12px;margin:0px;color:rgb(35,35,35);min-height:14px"><blockquote style="color:rgb(0,0,0);font-size:medium;margin:0px 0px 0px 40px;border:none;padding:0px"><div style="word-wrap:break-word"><div style="word-wrap:break-word"><div style="margin:0px;font-size:12px;color:rgb(35,35,35);min-height:14px"><blockquote type="cite" style="border-left-color:rgb(0,33,98);color:rgb(0,33,98);border-width:1px;margin-left:0px;padding-left:10px;padding-right:0px;margin-right:0px"><span style="border-collapse:collapse;color:rgb(34,34,34)"><div style="margin:0px"><span style="color:rgb(136,136,136)">w/ </span><a href="http://artsy.net/" target="_blank">Artsy</a></div><div style="margin:0px"><a href="http://cocoapods.org/" target="_blank">CocoaPods</a> / <a href="http://cocoadocs.org/" target="_blank">CocoaDocs</a></div><div style="margin:0px"><a>@orta</a> / <a href="http://orta.github.com/" target="_blank">orta.github.com</a></div></span></blockquote></div></div></div></blockquote></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Sat, Feb 18, 2017 at 7:26 PM, Maxim Veksler via swift-build-dev <span dir="ltr">&lt;<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>Ayaka Nonaka gave a talk[1] about basic scripting[2] support in Swift. <br></div><div><br></div><div>The gist of the idea is to use <span class="m_-8301894335232168815inbox-pl-c" style="box-sizing:border-box;color:rgb(150,152,150);font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap">#!</span><span style="color:rgb(150,152,150);font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:12px;white-space:pre-wrap">/usr/bin/env xcrun swift</span></div><div><br></div><div>Therefor it seems the basic building blocks for allowing a swift file to &quot;execute itself&quot; are always laid out and proved to be applicable. </div><div><br></div><div>What&#39;s missing IMHO is a better support for dependencies, the suggested solutions in the talk are using the -F for including frameworks that were built using Carthage or CocoaPods. That&#39;s not idle because a script I think should be self contained, meaning that you can &quot;just run it&quot; and it works. </div><div><br></div><div>So, I&#39;m wondering what if it was possible to include the dependencies inside the swift file itself? Probably using the same format as the Package.swift syntax. The the swift binary would &quot;detect&quot; that it&#39;s a self contained file, it could make this distinction because <span style="font-family:&#39;anonymous pro&#39;;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">import</span><span style="font-family:&#39;anonymous pro&#39;;font-size:11px;font-variant-ligatures:no-common-ligatures"> PackageDescription </span>is defined by the user.</div><div><span style="font-family:&#39;anonymous pro&#39;;font-size:11px;font-variant-ligatures:no-common-ligatures"><br></span></div><div>Then it would follow a 3 step process:</div><div>1. It should download and build the dependencies</div><div>2. then compile the code inside the file</div><div>3. and then run it. </div><div><br></div><div>Having everything happening behind the scenes, so the &quot;script user&quot; simply calls <font face="monospace">./MyScript.swift</font> or <font face="monospace">swift MyScript.swift</font> and it &quot;just works&quot;. </div><div><br></div><div>Wondering what the community thinks.</div><div><br></div><div>[1] <a href="https://realm.io/news/swift-scripting/" target="_blank">https://realm.io/news/<wbr>swift-scripting/</a></div><div>[2] <a href="https://github.com/ayanonagon/talks/tree/master/2015-swiftsummit/2" target="_blank">https://github.com/<wbr>ayanonagon/talks/tree/master/<wbr>2015-swiftsummit/2</a></div></div>
<br>______________________________<wbr>_________________<br>
swift-build-dev mailing list<br>
<a href="mailto:swift-build-dev@swift.org">swift-build-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-build-<wbr>dev</a><br>
<br></blockquote></div><br></div>