Live data from Hacker News

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

infoq.com

301–310 of 402 posts

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

#301
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…

> Mozilla gave us Rust Sorry for the nit but Mozilla didn’t give us Rust. They sponsored some of its development but that was only 3ish years after Rust started.

“Rust grew out of a personal project begun in 2006 by Mozilla Research employee Graydon Hoare. Mozilla began sponsoring the project in 2009 as a part of the ongoing development of an experimental browser engine called Servo. The project was officially announced by Mozilla in 2010.”

Sitting hairs really.

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

#302
post #139

Earlier quoted context omitted.

Yes, but that's OUR surveillance and we're cool with that

Id rather be spied on by foreigners who couldn't do anything about my eccentricities even if they cared. When you're own government's security services are spying on you, they own you.

They'll use the data to influence your next election. Just look at Moldova, who is infiltrated with Russian spies and dirty money. They've lost the last election but the country is paralysed by corruption.

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

#303

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

Seems so.

I often wonder what things would be like if Apple had improved upon Objective-C by fixing up the underyling C language. Yeah it'd no longer be a superset of C, but so what? Neither is Swift. Swift is great but I wish it was closer to Objective-C in spirit by deliberately being a more lightweight language. It's language spec is gargantuan - they've pretty much succeeded in making it a language as complex as C++.

Merely adding generics and better typing akin to TypeScript's, to Objective-C would've worked wonders and made the transition less abrupt.

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

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

> Rust code is almost as complex as C or C++ for any non-trivial application.

This is also, if not more, true for Swift as well. I've been working with both Swift and Rust (in addition to C++) for some time now and I find real-world, advanced Rust SIGNIFICANTLY easier to read and comprehend than real-world, advanced Swift. This is, IMHO, due to the fact that where Rust chooses to be syntactically simple, explicit and consistent, Swift chooses to be syntactically complex, idiom-based and feature-bloated. Sure, Swift code can look very modern and attractive at times, but usually when it comes to superficial code samples in Apple promotional videos. Otherwise, if you, say, look at a large codebase written by someone else, Swift reads just as badly as C++ complexity-wise.

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

#305
post #58

Earlier quoted context omitted.

I don't know if you can write high-throughput systems with 100% reference counted GC. Swift is targeted at UI work pretty hard.

Sure you can. C++ has reference-counted garbage collection with its smart pointers and RAII, just like Swift. People certainly write high-throughput systems in C++. Swift is slower than C++, yes, but not because of its memory management scheme.

Unless you go absolutely ham with smart pointers (which everyone knows not to do if you care about performance), C++ isn’t really a reference counting language.

I wouldn’t call RAII “reference counting”. I mean, I guess, but it’s the programmer or the compiler doing it. I’m talking about runtime reference counting.

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

#306
post #278

Is the Swift compiler itself written in Swift? How is it bootstrapped from source?

It's written in C++ although there is some Swift in it now [1]. The compiler doesn't depend on Foundation though.

[1] https://github.com/apple/swift/tree/main/SwiftCompilerSource...

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

#307

Earlier quoted context omitted.

That's not the case for PowerShell, though. Take a look at the list of supported platforms here: https://learn.microsoft.com/en-us/powershell/scripting/insta...

I suppose their point is that much as you can install and run PowerShell outside Windows, you can run Swift outside Apple's ecosystem. People just don't do either of those things very often.

With Swift, the support for other platforms is mostly token right now. As in, you can write code in it, but e.g. their sample app for Windows uses Win32 API directly - for Windows developers, that would be already considered outdated 20 years ago.

OTOH PowerShell actually works largely the same across all supported platforms, so it's equally useful on all of them in absolute terms. Now, outside of Windows, we've had decent shells for much longer, so its relative utility is indeed lower on those platforms (although not non-zero, if you find the notion of an object-oriented shell with a rich standard library useful). One particular use case where it comes in handy is when you have to script some automation for both Windows and Linux; e.g. cross-platform builds or CI. So mostly shared code, but in a few places you might need to do "if LINUX then ...".

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

#308
post #210

Earlier quoted context omitted.

Not sure why but most people don't seem to have noticed that people outside Apple will now be able to contribute to Foundation and these contributions will ship across all platforms.

Free labor for the world's most profitable corporation. Looking forward to it. And then they still take a cut of your revenue.

You also mean “paid labour From the worlds most profitable corporation” right?

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

#309

Earlier quoted context omitted.

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.

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 callstack frames (not sure Rust does that).

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

#310
post #67

Earlier quoted context omitted.

I don't particularly care, whether or not Swift ever leaves the Apple ecosystem (like ObjC). In that domain, Rust will never "win." I think that Rust is an awesome server language, though, and I'm glad to see it gain traction. I just hope that it doesn't get trashed by a bunch of junk dependencies, written in it. I find using apps written, using hybrid systems, or PWAs, to be quite painful (on Apple devices -and that…

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.
Post reply on HN