Live data from Hacker News

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

infoq.com

181–190 of 402 posts

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

#181

> A reimplementation of Calendar in Swift is 1.5x to 18x as fast as the C one (calling from Swift in various synthetic benchmarks like creation, date calculation). These sorts of statements in the industry always make me ask, "So did you guys make something terribly slow first, and then bring performance back close to where it originally was?" I'm not sure if the current Calendar app was ported to Swift, was original…

> "So did you guys make something terribly slow first, and then bring performance back close to where it originally was?"

In this case, the answer is basically, "yes". Objective-C is a neat language and really powerful in terms of flexibility and extensibility. But it gets that by essentially dynamically typed. It's Smalltalk duct taped onto C.

Dynamically typed languages are much slower unless you do lots of very powerful JIT magic, and even then they still tend to be quite a bit slower than most statically typed compiled languages.

Building Swift on top of an Objective-C core library makes a lot of sense in terms of getting Swift adoption when Swift was new. But in terms of performance, it's sort of like building a concrete bunker on top of a straw hut. You really want the bottom of your stack to be the faster, statically typed language. Then you can layer dynamic scripting languages on top for the users who want it.

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

#182

Earlier quoted context omitted.

It simply sounds like there isn't much demand for Swift from the Open Source community. Apple certainly makes a big push for it internally, but outside their platform, Swift doesn't have much momentum. If Apple wants people to use Swift like a first-class runtime, they should stop treating third-parties like second-class citizens. They have $200 billion dollars in cold, hard cash - surely some of it could go towards…

1st class support for Linux is a must. It's a pain to distribute anything you write in swift (unless you can now statically-link?) By this a mean common distros like Debian Stable must have a package for core libs, going to https://www.swift.org/download/ doesn't cut it.

The compiler has supported static linking the runtime libraries since 5.3.1, IIRC, and the package manager does so by default when targeting Linux since the acceptance of SE-0342: https://github.com/apple/swift-evolution/blob/main/proposals...

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

#183

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#.

Because, as they said, they're "cross platform" but really only exist in one place.

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

#184

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!")

That's kind of one of Swift's things - it is designed to be as accessible as a scripting language but scalable to full applications and system software.

Ideally it gives you some of the convenience and accessibility of a language like Python, combined with runtime efficiency of a language like Objective-C.

print("hello, world") is a cute example since it's a valid program in both Python and Swift.

(Though I still haven't forgiven Python for removing the print statement, which dates back to BASIC antiquity.)

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

#185

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…

If I recall Swift has a very interesting ABI for generics.

1. https://faultlore.com/blah/swift-abi/

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

#186

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…

[deleted]

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

#187

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…

[deleted]

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

#188

Earlier quoted context omitted.

I think the fact that Rust won't provide inheritance based OOP workflows means that something like swift will always be valuable, especially for application development.

What is the value provided by inheritance? It was my understanding that this was deliberately excluded from Rust as it's now seen as a bit of an anti pattern mostly inferior to traits.

Inheritance is about providing business logic in all downstream inheritors through a super() chain. If you want shared logic in Rust between several implementors of a trait you will probably end up with duplicate code. There are drawbacks to both.

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

#189
post #41

This will take a while, but I'm looking forward to it. It's probably another big step towards "Swift everywhere," without worrying about bridging to C. I've been doing little but Swift since 2014, and really like the language. I'm still "on the fence" about SwiftUI, but that's mostly because of the level of support from Apple, and the [im] maturity of the system. This will help with that.

Yes, and it means Swift scripts and modules that don’t reference UIKit/AppKit/SwiftUI/Combine will run on Linux and possibly Windows with zero or little modification. I‘m a little sad though that they didn’t start this endeavor years ago, because IMO Rust has already built so much momentum that it will win (for the popular, medium to long term definition of „winning“).

Swift would never have won, and will never win, while it's so closely associated with Apple. Many people in positions of power believe (correctly) that Apple will always put its own needs above everyone else's. Those are the people who have chosen Rust.

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

#190

This is an other step in the direction to a Swift-only Apple platforms. I don't think it would be worth my time to even buy a other macOS device to port my framework. I don't think they will get any benefit from this.

It's a good question as to how long Apple will support calling its APIs from C++ via Objective-C++.

I don't see any good reason for them to deprecate the ObjC-Swift bridge, but I guess they could decide it's too much work to maintain.

Post reply on HN