4 ms·
Isn't Swift, which came from Apple, memory-safe in a single thread environment? It can't prevent data races at compile time like Rust, but I thought it was far
by varenc 5y ago
Isn't Swift, which came from Apple, memory-safe in a single thread environment? It can't prevent data races at compile time like Rust, but I thought it was far safer in practice than C/C++/ObjC where I suspect all these vulns originate.
- grishka 5y agoSwift is their "user-facing" language because this trendy stuff with "smart" languages is apparently very important for PR. I would be surprised if most of the OS itself is written in something other than C/C++/ObjC.
- smilespray 5y agoI take it you're not a big fan of Swift, but there's little need to veer over into borderline conspiracy theories. I do think Apple is honestly committed to Swift over the long term, but it takes loads of time and care to replace the foundations of a building that's in daily use.
- grishka 5y agoI'm not a fan of these "smart" languages in general. I'm one of those who believes that the syntax of the language itself should be dumb, but all the smarts should be in the standard library. Like in Java for example. It's much easier to reason about what the code actually does when the language is dumb and calls into its standard library are explicit. It's bad when some benign-looking syntactic constructs trigger some kind of complex behavior. They might be committed to it, but I'm doubtful that it's at all possible to write e.g. parts of the kernel in it. And maybe, just maybe, they should direct all their efforts toward rewriting the OS in a safer language instead of making their UIs uglier with nonsensical paddings and messy-looking icons that pretend that there's no pixel grid.
- pjmlp 5y agoMetal and Driver Kit came after Swift, they happen to be written in a mix of C++ and Objective-C, with Swift bindings.
- smilespray 5y agoFair point. Is it fair to guess that development started before Swift was ready for prime time, and before Apple's own devs of these were up to skill?
- pjmlp 5y agoOnly a couple of macOS frameworks are pure Swift, most of them are actually bindings via Objective-C runtime interop.
- rdsnsca 5y agoThe dock was rewritten in Swift, a few other parts of macOS have been too.
- grishka 5y agoOh so I guess that's why I'm seeing "ghosts" of finder windows under the dock sometimes, especially right after taking a screenshot? And they disappear if I switch to finder. I kept thinking "how could they've possibly broken that". Updated to 12.1 today, will see whether that improves anything. But it would be more interesting to see the parts that deal with untrusted data (file format parsers, protocol handlers) rewritten in Swift.
- AceJohnny2 5y agoAbsolutely, but Apple clearly hasn't decided to switch their foundation libraries to it. I suspect it'll be a decade-long effort, but it can't happen too soon.