Earlier quoted context omitted.
Yes, and it means Swift scripts and modules that don’t reference UIKit/AppKit/SwiftUI/Combine will run on Linux and possibly Windows with zero or little modification. I‘m a little sad though that they didn’t start this endeavor years ago, because IMO Rust has already built so much momentum that it will win (for the popular, medium to long term definition of „winning“).
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.
Apple announces full Swift rewrite of the Foundation framework (2022)
221–230 of 402 posts
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#222Earlier quoted context omitted.
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.
The options weren't foreign government or local government, the current state is both, the future is local only. It's clearly an improvement. These security exploits also get used by local police who wouldn't have access to the top government access used for terrorists.
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#223Earlier quoted context omitted.
It’s not respectful to not read the link and instead ask somebody to summarise it for you.
You’re making the wrong assumption! I have read the article before I asked, and still have no idea what it is! Saying it provides these abstraction NSObject, NSString, NSArray tells me nothing! The article is clearly written towards readers familiar with Apple ecosystem.
The only built in types in Objective-C are the C types, like int, char and so on. The "Foundation" is a set of classes that implement many useful types that all inherit from a superclass called NSObject. The "NS" prefix refers to Next Step, the name of the company that Steve Jobs started and where Foundation was first created.
One of the advantages of this scheme is that it is possible to have heterogeneous collections (like an array of objects, where the objects do not all have to be of the same type/class).
Underneath the NS foundation (whose headers are all in Objective-C) is something called Core Foundation, which implements the same classes, but in pure C. To do this well requires huge programming discipline, especially around memory management, and much of that pain is taken away by using the NS classes.
Swift has already started replacing some of the foundation classes, NSString and NSDictionary, for example, giving them the names String and Dictionary without the cumbersome name-space two letter prefix.
I suspect that some of this rewrite may still "bridge" to the CF classes, but in other cases, it would be much better to simply write the class in its entirety in Swift.
I hope that helps.
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#224Earlier quoted context omitted.
Swift certainly can be a scripting language. #!/usr/bin/env swift print("hello, world!")
Of course, but so can C++ and Java: https://stackoverflow.com/a/29709521
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#225Tangental question: How do you Swift-using, non-app developers find out how to do basic anything non-app related, such as reading files and making network connections? I Google for stuff and probably 3/4s of the result are out of date and won't work in any reasonably modern version of Swift. I find Apple's Developer documentation sub-par, to say the least. So, how do you navigate it all? It's quite a shock coming fro…
Network comms are generally done using URLSession: https://developer.apple.com/documentation/foundation/urlsess...
Reading files is most often done using the String and Data types:
- https://developer.apple.com/documentation/foundation/nsdata/...
- https://developer.apple.com/documentation/swift/string/init(...:)
I've found Apple's documentation for Foundation to be quite exemplary.
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#226Tangental question: How do you Swift-using, non-app developers find out how to do basic anything non-app related, such as reading files and making network connections? I Google for stuff and probably 3/4s of the result are out of date and won't work in any reasonably modern version of Swift. I find Apple's Developer documentation sub-par, to say the least. So, how do you navigate it all? It's quite a shock coming fro…
https://developer.apple.com/documentation/foundation/file_sy...
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#227Earlier quoted context omitted.
I would not describe Rust as being particularly ergonomic. While it is a suitable replacement for C++, that is not necessarily a high standard to meet.
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…
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#228The article quotes this: > With a native Swift implementation of Foundation, the framework no longer pays conversion costs between C and Swift, resulting in faster performance. and this: > A reimplementation of Calendar in Swift is 1.5x to 18x as fast as the C one (calling from Swift in various synthetic benchmarks like creation, date calculation). First, that range of 1.5x-18x is kind of huge. Why? Second, why would…
This is somewhat analogous to the same arguments that can be had about JIT compiled languages having the the opportunity to exceed performance of AoT compiled ones because of inlining opportunities- except in this case I don’t know if the call has any chance of being actually inlined so much as at least bypassing the message passing machinery overhead.
Re: Apple announces full Swift rewrite of the Foundation framework (2022)
#229Is there anything genuinely innovative about Swift or is it just another "cross-platform scripting language" that I'll only see on 1 platform? The only reason I learned Powershell is because I have to admin for Windows. At least Powershell is interesting for its pipeline and object handling. I get not one spark of joy from Swift, and the comments I see are "at least we're not writing C anymore". Stockholm syndrome. S…
But hey, we're stuck with it now so no use complaining.