Live data from Hacker News

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

infoq.com

311–320 of 402 posts

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

#311
post #227

Earlier quoted context omitted.

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 fa…

This isn't really the case. Rust code is almost as complex as C or C++ for any non-trivial application.

That doesn’t make it less straightforward to read than Python or Ruby, where you have a variety of dynamic ills to contend with.

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

#312

Does it mean Objective C is going to be second-class language? It would be a pity, I prefer Objective C to Swift.

I used to too, it took me a while to switch, but now I see the benefits. Obj-c does give a lot more freedom, and sometimes you still need it, but what initially felt restrictive does actually lead to less buggy and predictable code, and some protocols like codable cut out massive amounts of code.

I still rely on some stuff like GCD that isn't very swift like, there still isn't anything as fine grained in Swift, but I'm liking combine in some cases.

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

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

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

#314
post #268
post #147

Earlier quoted context omitted.

I watched a Rust intro video recently that provided a perspective I liked, so I’ll share that here: MS, Apple, Google (and more) all relied heavily on C for low level code that needed to be as performant as possible. It turned out though that C‘s memory management is so problematic that many/most security issues are caused by it. To address that, Google invented Go, Apple made Swift, Mozilla gave us Rust etc. MS is i…

If it was just a matter of avoiding memory safety Java and ML were right there, and these languages are pretty different from each other. It's not just memory safety. Go gets motivated by highly concurrent systems with large numbers of programmers and prioritized simplicity and developer experience. Rust was aiming at very high performance at the extended of complexity and compile times, and Swift wanted to build UI…

Java made the mistake of being VM based, no value types, and AOT only available via expensive 3rd party plugins.

Had Java been like Modula-3 or Eiffel since version 1.0, Go might never have happened at all.

Thankfully they are on the right path to fix those issues.

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

#315
post #147

Earlier quoted context omitted.

I watched a Rust intro video recently that provided a perspective I liked, so I’ll share that here: MS, Apple, Google (and more) all relied heavily on C for low level code that needed to be as performant as possible. It turned out though that C‘s memory management is so problematic that many/most security issues are caused by it. To address that, Google invented Go, Apple made Swift, Mozilla gave us Rust etc. MS is i…

Note that Apple is known er use Rust for some of its infrastructure and Google is adopting Rust in a big way in Android and Fuchsia.

Currently the Android team doesn't have any plans to expose Rust support on the NDK/AGK, anyone going down that path is expected to support themselves in Android Studio, Gradle, CMake, android-ndk, AAR/Bundles, JNI integration.

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

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

> Really looking forward to OOP being phased out.

All the higher level macOS APIs are still object oriented, and I don't see that changing TBH. And macOS application source code is essentially just minimal glue code to tie those system APIs together, in the end, the programming language used for this glue code doesn't matter all that much, since the code is completely dominated by API calls.

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

#317
post #309

Earlier quoted context omitted.

Swift will never win against Rust for a much simpler reason: performance. Invariably, rust is chosen where performance is critical, and Swift’s reference counting GC ensures it will never compete with Rust in those scenarios.

Slight correction: Swift‘s ARC is not a GC (the compiler just inserts retain/release calls where it’s necessary), and one can write very performant code by steering clear of reference counted types, and Objective-C types (dynamic dispatch is really slow). Value types with copy-on-write shouldn’t impose much overhead. Automatic inlining is progressing nicely AFAIK, and recently introduced concurrency can collapse call…

It is definitely one per CS definition of automatic memory mangement algorithms.

Compiler optimizations are exactly that, optimizations that any automatic memory mangement implementation usually takes advantage of.

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

#318
post #256

Who else remembers when they re-implemented the (at the time version of) the Foundation framework in Java for WebObjects? That was, what, 1998? Right around when NeXT got re-absorbed by Apple, not sure if the rewrite was started before or after. https://developer.apple.com/library/archive/documentation/Le... https://en.wikibooks.org/wiki/WebObjects/Overview/Objective-... Those were the days! Actually kind of amazing…

I thought it was NeXTSTEP/Sun, but it seems disputed. https://stackoverflow.com/questions/473758/what-does-the-ns-...

What they collaborated was in Distributed Objects Everywhere, which ended up becoming Java EE.

https://en.wikipedia.org/wiki/Distributed_Objects_Everywhere

Their collaboration is also one of the reasons why Java is basically Objective-C semantics with C++ like syntax.

https://cs.gmu.edu/~sean/stuff/java-objc.html

Interfaces (protocols), dynamic class loading (plugins), RMI (distributed objects), jars (bundles), dynamic dispatch by default, object root class,...

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

#319
post #265

Earlier quoted context omitted.

You don't need ultra performant memory management for most of your code. Swift compiles to machine code and ARC is fine for most use cases and you can use unsafe raw pointers etc for your occasional hot code path where you want to optimize memory management.

I would love to see what this looks like in practice if you can point me to a link. (I’m now curious if the unowned keyword would have similar performance characteristics)

https://github.com/apple/swift-evolution/blob/main/proposals...

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

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

Given that all modern language support most OOP concepts, phasing out is not happening any time soon.
Post reply on HN