3 ms·
> but even the definition is quite short for the constraints it imposes. I'd have to look up how extension method would look in this case in C#, but my hunch i
by dmitriid 7y ago
> but even the definition is quite short for the constraints it imposes.
I'd have to look up how extension method would look in this case in C#, but my hunch is that it would be more lightweight and readable, with the same contstraints.
> You can import Darwin or Glibc to get direct access to fopen. It’s a bit unergonomic to use, though.
FileManager.default, .appendingPath etc. isn't ergonomic either ;)
> NSString, as a deprecated holdover from Foundation.
1. How is it deprecated if that's clearly the way to read/write files?
2. Foundation is the standard lib for Swift, and the way it's designed hurts Swift-the-language immensely, IMO. If that's deprecated, what's not deprecated and how can anyone figure that out?
> There’s also the nil-coalescing operator, but the whole point is that you can’t sweep an Optional under the rug.
There are several languages with Optionals, and they don't let you sweep them under the rug, and they provide better facilities to handle them.
IMO optionals the way they are (and a few other decisions) come precisely from the constraints of Foundation and original goals of Swift: to be a replacement for Obj-C when creating iPhone apps. That's why the NSStrings, and the awkward APIs, and the astonishingly large number of nullable parameters in API calls and nullable results from API calls.