Live data from Hacker News

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

infoq.com

351–360 of 402 posts

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

#351

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.

Swift is great. I’ve done a lot of it, but also bounced around between Typescript, Elixir and Java and every time I miss Swift’s strongly opinionated, highly descriptive and flexible style.

Also, for the most part, it’s vastly superior to Obj C. The sad thing is that when writing Obj C I often find myself not writing the clean, well structured solution that’s in my head out of sheer resistance to the verbosity that it would take. I always just keep thinking how simple it would be in Swift and how much longer and more keystrokes / files it takes in Objective C.

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

#352

Earlier quoted context omitted.

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

Right, but unlike C++ and Java, the scriptability of Swift was designed by spec. It's not a hack or convolution.

Java being used as a script is now also built in (since Java 11 in 2018): https://nipafx.dev/scripting-java-shebang/

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

#353
post #348

Earlier quoted context omitted.

I mean, you say "support themselves" but e.g. https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25...

Nothing of that covers "Android Studio, Gradle, CMake, android-ndk, AAR/Bundles, JNI integration", which an Android shop expects to have out of the box support in the Android SDK installer. Note that android-ndk in that comment means the original Makefile based build tooling, which CMake builds still lack some corner cases in functionality, hence why I listed both.

So, just to be clear, in what languages do I not need to "support myself" under your definition and what does the "support" consist of?

Do I get an Android test phone to try my software out? Is there like free phone support so I can chat to some expert in my language about Android problems? You make it sounds like a pretty big deal, but my small experience† of writing Android software a decade ago was that it just wasn't that hard.

† I wrote an implementation of the now obscure mOTP (similar to TOTP) for in-house usage. For obvious reasons I named This One Time app "Band Camp" which was already a pretty old reference at the time but once I thought of it I couldn't help myself.

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

#354
post #330

Earlier quoted context omitted.

Well that's easy. Swift is: 1. Much more expressive and featureful than Go 2. More concise and modern than C# (debatable maybe?) 3. Less JVM than Kotlin (the apples-to-apples; Java is a much worse language) 4. Way, way faster and more typesafe than Python 5. Better support for parallel execution (and probably fine-tuning other performance knobs) than TypeScript

1. Definitely, but Go is well very optimized for concurrent network apps. 2. I think the C# team has done very well modernizing. The runtime is a bit of a bother though. 3. There's Kotlin/Native and Kotlin/JS. 4. Python has dev speed and ML benefits. 5. If you're going this way, performance probably isn't your main goal? All-in-all, Swift is interesting, but (IMHO) lackluster crossplatform support and toolchain is a…

I have used all those languages seriously save C# (only lightly) and can safely say Swift knocks them all out of the park in terms of actually writing applications. Indeed, its cross platform support is lackluster, thats why we’re here.

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

#355

Earlier quoted context omitted.

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.

None. It's code organizational syntactic sugar and abstraction that incurs a runtime penalty (vtables). Go ditched OO for similar reasons. Haskell, Erlang, and more get along fine without OO. (OO crested with Smalltalk, Java, Ruby, Python, and JS (more prototypal though). Let's not talk about C++98)

Don’t trait objects work the same way as vtables (fat pointer)?

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

#356
post #197

Earlier quoted context omitted.

swift isnt new, but yeah i agree its not as exciting to think about as rust or Go. I think i prefer it over some of the oddities from TS, but certainly over js.

Swift can do everything Go does but better now that it has async/await because it has real types and a real unsafe API. Calling C from Go is horrendous.

good to know, i could use some convincing

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

#357
post #314
post #268

Earlier quoted context omitted.

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.

So Microsoft created C# to address that

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

#358

Earlier quoted context omitted.

This assumes that no subsequent language comes along and steals away all the, um, seekers after novelty lately chasing Rust and Swift.

> and Swift Can’t speak for Rust (but I hear that it is now quite mature -it predates Swift), but I’ve been programming Swift, since the day it was announced. In that time, the language, itself, has matured; possibly to the point that it’s starting to look a bit “Swiss army knife”-like. I’m not exactly your typical jargonaut. I’ve been writing software since 1983. Been through a lot of changes, paradigms, and just pl…

I do not claim everyone coding Swift or Rust is a novelty-seeker; rather, novelty-seekers were drawn to those languages, and will be drawn to others as they appear.

I can understand the appeal of abandoning Objective-C.

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

#359

Earlier quoted context omitted.

Interesting. I didn't realize C was so easy to exploit (I am a novice). Very interesting implications for security. Thanks for the cool insight.

It's not necessarily _easy_ to exploit iOS, the problem is that world governments and hacker orgs have budgets in the millions to find these exploits. We have already gone as far as we can by just telling people to be more careful when using C so to solve this problem the only way forward is languages which make it harder or impossible to make the mistake that keep happening in C programs. Apple opting for Swift and…

Ahh gotcha. Thanks for the background context.

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

#360

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.

> is Foundation the same thing as what one might normally term a standard library? I can't tell.

https://developer.apple.com/documentation/foundation

Post reply on HN