Live data from Hacker News

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

infoq.com

381–390 of 402 posts

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

#381
post #310
post #67

Earlier quoted context omitted.

I think whoever „wins“, it would be necessary to have good interop at least. Currently, Rust devs are integrating core libs into native iOS apps by going the C route. All this work to make everything memory safe, and then this.

Which direction are you talking? If you want to link against Rust there is little choice but to use a C layer because it doesn’t have a stable ABI.

I‘m talking Swift > Rust. TIL about the unstable ABI, thanks!

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

#382

Earlier quoted context omitted.

Conversely, will existing Obj-C (and hybrid Swift/Obj-C) apps be able to call the new Swift Foundation? And will it be binary-compatible with existing apps, or will Apple just ship a separate compatibility version of Foundation for use by legacy apps?

Yes, it’ll be binary compatible.

i don't understand how a compiled language like swift can be binary compatible with a dynamic one like objc. How are they going to implement method swizzling on NSObject for example ?

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

#383
post #313

It looks like an important step in progressively retiring ObjC. Swift is built from the start with a ObC compatibility in mind, which is a source of much ugliness and inefficiency in the language. With the Swift team working in a value semantic first language (Val), I can kind of see where this is going. Really looking forward to OOP being phased out.

i don't think people working on val are part of the swift team anymore.

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

#384
post #345
post #343

Earlier quoted context omitted.

I have never used IMP caching, and don't think the average developer uses this (aside from indirect use of Apple's frameworks). Otherwise: > A normal Objective-C message send is a bit slower, as we'd expect. Still, the speed of objc_msgSend continues to astound me. Considering that it performs a full hash table lookup followed by an indirect jump to the result, the fact that it runs in 2.6 nanoseconds is amazing. Tha…

> So it's 9 cycles vs what, one? I'm not sure what you're asking? What are you trying to compare?

I’m comparing a message send with a statically linked function call (or inlining, as mentioned by sibling comment).

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

#385
post #379

Earlier quoted context omitted.

> Java, Kotlin and C++. I just tried this and... no C++. You can add the NDK and start building stuff with C++, but that's also exactly how the Rust offering works. If the result was actually a properly configured out of the box C++ development environment that would be pretty nice besides the Android stuff, but it isn't, the actual result out of the box is you get to pick Java or Kotlin. You can do C++ native develo…

Since when does Rust appear as language selection on the NDK installer? Has out of the box support on Android Studio for: - mixed language debbugging - project templates wizard - code completion and linting - JNI bindings generation - two way editing between native JNI wrappers and Java/Kotlin native method declaration - packaging of Android libraries for native code And for game developers, if they so which, plugins…

Since editing window is already out, I am not arguing against Rust, and would welcome first class support for Rust on the Android tooling (Android/VS Studios, NDK, AGDK, Modules/Bundles) and being visible across https://developer.android.com documentation.

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

#386
post #378
post #363

Earlier quoted context omitted.

By OOP I mean entangling of behavior and type hierarchy (mainstream class-based OOP aka. C++ OOP). Dot-notation and methods do not equate OOP. But of course, it depends on your definition. Pretty much anything can be called “OOP” if one wants to.

Ah so interfaces/traits/type classes hierarchies suddenly isn't OOP, nor dynamic /static method dispatch with type polymorphism, got it.

The defining feature of mainstream OOP (as popularised by languages like C++ and Kava) is the entanglement of type hierarchy and API contract. In other words, inheritance. And inheritance is the main point of criticism of the mainstream OOP. You can call it class-based programming if you feel this is more accurate. Let's not get stuck at terminological issues.

At any rate, I apologise for using such an ill-defined term as "OOP" in the first place. This terminology is so overladed and washed out at this point that it might sense to retire it altogether.

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

#387
post #383
post #313

It looks like an important step in progressively retiring ObjC. Swift is built from the start with a ObC compatibility in mind, which is a source of much ugliness and inefficiency in the language. With the Swift team working in a value semantic first language (Val), I can kind of see where this is going. Really looking forward to OOP being phased out.

i don't think people working on val are part of the swift team anymore.

Ah, thanks for pointing this out. I was not aware that Abrahams has left Apple...

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

#388
post #270

Earlier quoted context omitted.

This is just plain cynicism and dramatization. “Massive instability” lol as if anyone with a desktop OS of any sort in 2023 has had anything close to that kind of experience. Let me know when my scroll bar UI is lagging like it’s 2003 in Cupertino. I’m sure Jaguar had zero errors and had all the code audited by Steve Jobs himself to make sure it had top quality. And for real what indicator is there that Apple has low…

Agreed

I lost all my files during the transition to APFS.

Luckily I had a backup, but it was about a month old.

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

#389
post #384
post #345

Earlier quoted context omitted.

> So it's 9 cycles vs what, one? I'm not sure what you're asking? What are you trying to compare?

I’m comparing a message send with a statically linked function call (or inlining, as mentioned by sibling comment).

This has the feel of premature optimization. These are the fastest operations. Their running time starts to get overwhelmed by the slower operations as you go down the list of things tested. Making the fastest operations a few times faster doesn't necessarily have any noticeable effect on your program.

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

#390

Earlier quoted context omitted.

macOS and iOS not so much. Which is probably one of the reasons why apps for these platforms are often much better (or at least more polished) than say Windows apps.

In my view, "polish" is rather orthogonal. For trivial apps that just assemble the building blocks that come out of the box, I'd agree. Otherwise, I find the "native" developer experience (XCode, Swift compiler) to be rather unpleasant. Moreover, the economics of developing "natively" limit the amount of polish you can actually justify.

The way to deal with that, is develop (or buy|integrate) dependencies that natively implement polish and chrome.

For example, a UI framework may implement good transition animations. That’s pretty typical. Write an extension to UINavigationController, or UIViewController (if you use UIKit) that implements these transitions, package it as a standalone project, and integrate it, or simply have project-specific baseline framework extensions.

That’s what I do. I have a ton of these packages[0].

It’s a fair bit of work, to do it yourself, but there are package[1] and extension[2] indexes. Caveat emptor.

[0] https://riftvalleysoftware.com/work/open-source-projects/

[1] https://swiftpackageindex.com/

[2] https://swifterswift.com/

Post reply on HN