3 ms·
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 on
by eatonphil 4y ago
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.
- mplewis9z 4y ago> my impression is that the support on Linux within the Foundation is not complete It is not, but it's like 95% of the way there in my experience - most things that are missing are relatively recent additions that have some complex OS interactions, like filesystem I/O with language-level concurrency features. > Does this change imply better (eventual) support on non-Darwin systems? Yes. The non-Darwin Foundation version is already rewrite that takes a lot of effort to keep in lock-step with the closed-source Objective-C version, so unifying the implementations in Swift will both reduce the amount of maintenance effort and promote non-Darwin platorms to more of a "first-party" status. > Also, is Foundation the same thing as what one might normally term a standard library? It's more of a standard library++, including some things that other languages include in their standard libraries (Date/Time models) but also other things that are common to put in third-party libraries (networking, etc.). You do not need to use Foundation for basic things like arrays or concurrency that are built into the normal standard library.
- eatonphil 4y ago> complex OS interactions, like filesystem I/O with language-level concurrency features. Do you mean like io_uring? That wouldn't be too surprising. Even Go doesn't have that in the standard library yet. > so unifying the implementations in Swift will both reduce the amount of maintenance effort and promote non-Darwin platorms to more of a "first-party" status. That's what I was hoping for. Thanks!
- avisser 4y ago<bikeshed> It feels off to call things like Array part of any library when you have array literal syntax `let oddNumbers = [1, 3, 5, 7, 9, 11, 13, 15]` I'd call that a language feature. Or maybe with Swift there is a blurry line between the two?
- saagarjha 4y agoArrays are part of the Swift standard library. Foundation is another library that provides access to things like I/O, networking, calendars, etc.
- mayoff 4y agoArray is defined in the Swift standard library, but the compiler knows about the type directly, and also recognizes various @_semantics("array.blah") annotations that appear in the standard library source code. I believe the semantics annotations are primarily to help the optimizer. https://github.com/apple/swift/blob/main/stdlib/public/core/Array.swift https://github.com/apple/swift/blob/main/stdlib/public/core/...
- klodolph 4y agoFoundation is more like a standard library for Objective C. Some components are not needed in Swift.
- dcow 4y agoFor high level applications, Foundation is almost always imported and can pretty much be assumed. It's kind of a de facto standard library extension. The problem as you put it is that what's available on macOS/iOS is not fully available on other platforms. So you can't just take some software that uses Foundation and compile it for a non-apple system without potentially running into a bunch of things you need to implement or polyfill or whatever you want to call it. Foundation has been growing its support for other platforms over the years, so the situation has been getting better. But it's been hard to take the "open source cross platform" goal of Swift seriously when they there is clearly a priority given to apple platforms.
- pkulak 4y agoSwift is great because it's the only alternative to Objective C. I don't really think anyone is clamoring for it to move into non-Apple domains.
- frizlab 4y agoI know I do. Swift is an amazing language, truly.
- Apocryphon 4y agoHow so?
- yAak 4y agoI would love it. Swift is fantastic, and by far my favorite language to write client code in. (Compared to Rust, TypeScript/JS, ObjC, C++, C#, & Java.)
- ianlevesque 4y agoWhy do you prefer it to Rust? I don't have a horse in the race just limited time to learn languages these days.
- antfarm 4y ago> is Foundation the same thing as what one might normally term a standard library? I can't tell. https://developer.apple.com/documentation/foundation https://developer.apple.com/documentation/foundation