Re: Need for Swift
Re: Need for Swift
- Subject: Re: Need for Swift
- From: Charles Srstka via Cocoa-dev <email@hidden>
- Date: Mon, 14 Oct 2019 19:32:36 -0500
> On Oct 14, 2019, at 7:21 PM, Jens Alfke <email@hidden> wrote:
>
>> On Oct 14, 2019, at 5:02 PM, Charles Srstka <email@hidden
>> <mailto:email@hidden>> wrote:
>>
>> Swift, on the other hand, can actually *be* a scripting language if you want
>> it to; put #!/usr/bin/env swift at the top of a source file, give it execute
>> permissions, and voilà, it’ll run just like a script.
>
> *Anything* can be a scripting language in that sense, in Unix. I could write
> a two-line script called "run_c" containing*:
> #! /bin/bash
> cc "$1" -o /tmp/a.out && /tmp/a.out
> and put it somewhere in my path; then I can put "#! /usr/bin/env/run_c" at
> the top of any C source file and run it as a script.
>
> To me, "scripting language" strongly implies a CLI, plus dynamic typing, and
> no boilerplate (so I can write one-line programs.)
>
> —Jens
>
> * Typed in Mail. Should work, but I haven't tested it.
Yeah, but Swift actually has first-party support for it, unlike that rather
hacky solution. Its syntactical similarity to scripting languages was also a
big part of the promotional materials that Swift launched with (see:
https://www.apple.com/ne/newsroom/2015/12/03Apple-Releases-Swift-as-Open-Source/
<https://www.apple.com/ne/newsroom/2015/12/03Apple-Releases-Swift-as-Open-Source/>
- "Introduced in 2014, Swift is the fastest growing programming language in
history and combines the performance and efficiency of compiled languages with
the simplicity and interactivity of popular scripting languages.”) It seems
clear that the intention is to blur the lines a bit, although
implementation-wise Swift is certainly very much on the compiled, static-typed
side of the fence.*
Charles
* Unless, of course, you put `dynamic` on everything, on an Apple platform.
Then, you’re basically writing Objective-C with a different syntax.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden