Live data from Hacker News

Apple announces full Swift rewrite of the Foundation framework (2022)

infoq.com

171–180 of 402 posts

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#171
post #139

Earlier quoted context omitted.

Considering that both Google and Apple are cardholding members of PRISM, it sounds like a bit of a frying pan vs fire situation to me.

Yes, but that's OUR surveillance and we're cool with that

Id rather be spied on by foreigners who couldn't do anything about my eccentricities even if they cared.

When you're own government's security services are spying on you, they own you.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#172

Earlier quoted context omitted.

More controlled by who?

Apple. They now gatekeep access rather than it being open to anyone with the money to hack the platform.

So, we should feel safe knowing that Apple is protecting us from the wrong governments and working with the right ones? Considering how attached they are to the Chinese market, one would be forgiven for assuming Apple too is motivated by money over ethical responsibility.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#173

Is there anything genuinely innovative about Swift or is it just another "cross-platform scripting language" that I'll only see on 1 platform? The only reason I learned Powershell is because I have to admin for Windows. At least Powershell is interesting for its pipeline and object handling. I get not one spark of joy from Swift, and the comments I see are "at least we're not writing C anymore". Stockholm syndrome. S…

> Is there anything genuinely innovative about Swift

Apple's thing is innovation - taking technology that exists but is clunky and making it accessible.

Swift is intended to be a more accessible alternative to Objective-C. It is memory safe (reference counted like Objective-C's ARC but built into the language) and type-safe, and has modern features such as named parameters, generics, duck typing, closures, multiple values, inline arrays and dictionaries, etc.. It's intended for writing user apps, but is also suitable for writing system frameworks. It also has some (possibly overly) clever syntactic sugar that has enabled SwiftUI's pseudo-declarative API.

Regarding memory safety we have: Swift (mostly reference counting), Rust (mostly compile-time checks), Java (mostly garbage collection), and C++ (smart pointers or manual/unsafe.)

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#174

Earlier quoted context omitted.

Afaik Swift is pretty close to using Rc and Arc everywhere. Does swift do some more escape analysis than Rust?

Swift only uses reference counting when working with objects; Structs are optimised using copy-on-write. There's currently work on implementing move and ownership semantics, similar to Rust, but opt-in rather than by default.

Ummm… No.

Swift structs are just like C structs (from a memory perspective). The copy-on-write thing is implemented manually by storing a private refcounted object in your struct. See the implementation of Array for example: https://github.com/apple/swift/blob/main/stdlib/public/core/...

There’s no magical copy-on-write mechanism at the language level.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#175

Is there anything genuinely innovative about Swift or is it just another "cross-platform scripting language" that I'll only see on 1 platform? The only reason I learned Powershell is because I have to admin for Windows. At least Powershell is interesting for its pipeline and object handling. I get not one spark of joy from Swift, and the comments I see are "at least we're not writing C anymore". Stockholm syndrome. S…

Swift doesn't really have to be "genuinely innovative" – it's a modern, ergonomic language which is pretty easy to pick up and and use, has decent performance and a solid type system combined along with the familiarly of a C-like imperative language. It has pretty obvious usability and expressiveness benefits relative to Objective C while being designed for effective interoperability with a massive existing set of co…

Innovation isn't the same as invention. Apple didn't invent the MP3 player or the smartphone, but they certainly innovated with the iPod and the iPhone, which combined technologies into useful and accessible products.

Swift might not change the industry, but it makes life easier for anyone who wants to develop on an Apple platform but finds Objective-C unwieldy. Also it provides a path for Apple to migrate its platforms to memory-safe languages, which can reduce bugs and security vulnerabilities.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#177

Is there anything genuinely innovative about Swift or is it just another "cross-platform scripting language" that I'll only see on 1 platform? The only reason I learned Powershell is because I have to admin for Windows. At least Powershell is interesting for its pipeline and object handling. I get not one spark of joy from Swift, and the comments I see are "at least we're not writing C anymore". Stockholm syndrome. S…

Powershell and Swift are so far apart in design as well as intended use cases that I'm not sure why you'd even want to compare them. It's like comparing Zsh to C#.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#178

Is there anything genuinely innovative about Swift or is it just another "cross-platform scripting language" that I'll only see on 1 platform? The only reason I learned Powershell is because I have to admin for Windows. At least Powershell is interesting for its pipeline and object handling. I get not one spark of joy from Swift, and the comments I see are "at least we're not writing C anymore". Stockholm syndrome. S…

For one, Swift is not a scripting language.

Swift certainly can be a scripting language.

  #!/usr/bin/env swift
  print("hello, world!")

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#179

Earlier quoted context omitted.

For one, Swift is not a scripting language.

Swift certainly can be a scripting language. #!/usr/bin/env swift print("hello, world!")

Of course, but so can C++ and Java: https://stackoverflow.com/a/29709521

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#180

Earlier quoted context omitted.

Aside from Swift having automatic reference counting, and Rust relying more heavily on its borrow checker, Swift and are super similar languages. If what you want is an ergonomic language that lets you combine the best of ML type systems with C family imperative programming then they’re the two obvious choices.

I would not describe Rust as being particularly ergonomic. While it is a suitable replacement for C++, that is not necessarily a high standard to meet.

Reading the super majority of Rust code is equally easy or easier than reading Python, or Typescript, or even Ruby.

Writing Rust applications is also very ergonomic. The Rust web server frameworks are approaching the ergonomics of Typescript web server frameworks.

The only Rudy lacking ergonomics is writing net new frameworks or missing framework pieces, or when std is not available.

95%+ of all new Rust code will fall into the bucket of “ergonomic to write and read”.

Post reply on HN