Live data from Hacker News

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

infoq.com

31–40 of 402 posts

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

#31

I don't know Swift too well but my impression is that the support on Linux within the Foundation is not complete. (Also, is Foundation the same thing as what one might normally term a standard library? I can't tell.) Does this change imply better (eventual) support on non-Darwin systems? Or maybe I've misread it and the change is unrelated.

Foundation is more like a standard library for Objective C. Some components are not needed in Swift.

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

#32

I don't know Swift too well but my impression is that the support on Linux within the Foundation is not complete. (Also, is Foundation the same thing as what one might normally term a standard library? I can't tell.) Does this change imply better (eventual) support on non-Darwin systems? Or maybe I've misread it and the change is unrelated.

For high level applications, Foundation is almost always imported and can pretty much be assumed. It's kind of a de facto standard library extension. The problem as you put it is that what's available on macOS/iOS is not fully available on other platforms. So you can't just take some software that uses Foundation and compile it for a non-apple system without potentially running into a bunch of things you need to implement or polyfill or whatever you want to call it. Foundation has been growing its support for other platforms over the years, so the situation has been getting better. But it's been hard to take the "open source cross platform" goal of Swift seriously when they there is clearly a priority given to apple platforms.

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

#34
post #18

Todd, you owe me $20. (Todd said this would never happen) Also, this is great news, and it will be interesting to see what kind of real-world changes in performance this has.

I really should have started using Long Bets years ago. Ten years ago a “Tanya” told me she would never use an ebook to read literature. I’m pretty sure if I went to her house today I’d find 2. In fact I may be the only person I know who doesn’t own one (not wanting one and being fundamentally against them are two different things). That’s the most memorable but I’ve had these sorts of “over my dead body” conversatio…

Had never heard of Long Bets, I really like it (https://longbets.org/ for others who, like me, were unfamiliar). Is there a way to see the month and day of month when the bet or prediction was made? I can see the duration, e.g. "Duration 4 years 02017-02020", but don't see the actual date.

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

#35

I don't know Swift too well but my impression is that the support on Linux within the Foundation is not complete. (Also, is Foundation the same thing as what one might normally term a standard library? I can't tell.) Does this change imply better (eventual) support on non-Darwin systems? Or maybe I've misread it and the change is unrelated.

> my impression is that the support on Linux within the Foundation is not complete It is not, but it's like 95% of the way there in my experience - most things that are missing are relatively recent additions that have some complex OS interactions, like filesystem I/O with language-level concurrency features. > Does this change imply better (eventual) support on non-Darwin systems? Yes. The non-Darwin Foundation vers…

It feels off to call things like Array part of any library when you have array literal syntax `let oddNumbers = [1, 3, 5, 7, 9, 11, 13, 15]`

I'd call that a language feature. Or maybe with Swift there is a blurry line between the two?

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

#36
Someone knowing existing pattern help me understand this. right now when i use these “foundation” apis in swift it is doing c call? so they rewriting now the c code in swift? (dont do ios or mac code so now sure)

me dont understand what make it faster now. i once wrote some jni code to call c++ library from java. does mean there some similar code to do cross language call? they get rid of it and so things now faster?

offtopic but debugging crashes in c++ over jni call was super hard. logs not work and me not figure out how to fix. wonder if they had similar “troubles” and this make everything easier :)

always feel skeptical when seeing large code base have “rewrite”. try many time in me career thinking there good reasons but super hard and not best value in end

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

#37
post #8

Earlier quoted context omitted.

Things will get even slower.

Just to explain why Objective C code, in practice, is not especially fast: You generally make the choice between writing something in pure C, which gives you plenty of performance but little safety, or using Objective C classes and methods, which gives you plenty of safety but you're paying the price for dynamic dispatch (objc_msgSend) and pointer indirections all the time. Swift makes it easier to eliminate things l…

In practice would be what the resulting apps turn out like.

In my experience, old-school ObjC iOS and Mac apps generally tended to be quite snappy.

On the other hand, the new Swift hotness of Messages and Settings on macOS are noticably slower than what they're replacing.

Of course I haven't done a comprehensive inventory, but I certainly don't have the general impression of things getting faster with Swift. (Are there examples of this?)

My guess is any theoretical gains are generally swamped by the language culture of complex abstractions.

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

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

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

#39
post #20

I am pretty certain that most of high level use cases for Rust could be replaced with Swift, with increased developer velocity, if Swift was actually cross platform. And that's coming from a Rust fan. It will be interesting to see how effective this rewrite is.

How would you compare Swift with Kotlin in terms of being a good stand-in for high-level Rust?

I've not paid attention to Kotlin in a while, but it seems like there's more progress at supporting Kotlin across more platforms (Kotlin native, web?, etc). I'm curious if people feel that the language features and design are at about parity, or if one is significantly stronger/weaker.

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

#40
post #39
post #20

I am pretty certain that most of high level use cases for Rust could be replaced with Swift, with increased developer velocity, if Swift was actually cross platform. And that's coming from a Rust fan. It will be interesting to see how effective this rewrite is.

How would you compare Swift with Kotlin in terms of being a good stand-in for high-level Rust? I've not paid attention to Kotlin in a while, but it seems like there's more progress at supporting Kotlin across more platforms (Kotlin native, web?, etc). I'm curious if people feel that the language features and design are at about parity, or if one is significantly stronger/weaker.

Swift has the distinction (for better and worse) of not being tied to the JVM.
Post reply on HN