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:02:52 -0500
> On Oct 14, 2019, at 2:30 PM, Jens Alfke <email@hidden> wrote:
>
>> On Oct 14, 2019, at 11:25 AM, Carl Hoefs via Cocoa-dev
>> <email@hidden <mailto:email@hidden>> wrote:
>>
>> I see Computer Science students here falling into two groups. The group that
>> likes Swift generally likes scripting languages, Python, and the like.
>
> Whoa, I completely disagree. Objective-C is much, much closer to scripting
> languages than Swift, with all of its dynamic features:
>
> * It has the 'id' type that represents any type of object
> * you can send a message to an arbitrary object whether or not its class
> declares it
> * you can intercept unhandled messages and do arbitrary things to handle them
> * you can add, remove or override methods at runtime
> * you can even create classes at runtime
>
> Swift is very strongly-typed and less dynamic: it's very strict and nit-picky
> about types, protocol conformance, etc. Much more like C++.
>
> Are you lumping Swift in with scripting languages simply because its
> method-call syntax is more normal looking? Or because compiler type inference
> sometimes allows you to omit variable types?
It’s kind of a funny dichotomy; Swift is a strictly typed language under the
hood, but it *looks* like a scripting language on the surface, what with its
type inference, JavaScript-looking-like “let” and “var” declarations, implicit
closure parameters, and whatnot. Objective-C, on the other hand, is like one
step down from Ruby on the dynamism scale under the hood, but on the surface it
looks like a statically-typed language, thanks to the mandatory types on every
variable declaration, even if the type is just ‘id’—although it usually isn’t,
since in common practice we specify object types even though it’s not strictly
necessary, and some of them can be kind of obnoxious (hello, block syntax).
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.
>> (There is a third group that likes both languages, but it is very small.)
>
> Most experienced iOS/Mac developers I know like both.
I’d agree with that.
Charles
_______________________________________________
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