-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-1756] Implement SE-0069 Foundation Value Types for Linux #4140
Comments
I believe @phausler already has some of this ready to go, using the Darwin implementation. Philippe? |
@belkadan If that is the case, its useless on Linux because `ReferenceConvertible` is not gonna be present on the Linux platform. Today I'm gonna try to adapt the code in https://github.com/apple/swift/blob/d68c6dcd6b4be19cff9f6e82e2811884de56b6fa/stdlib/public/SDK/Foundation/UUID.swift To Linux, without reference convertible, and not backed by CoreFoundation. |
Sorry, when I said "using the Darwin implementation" I meant "based on the Darwin implementation". Please coordinate with Philippe either way. We don't want to duplicate work! |
@belkadan @phausler Of course, I'm ready to work on this today. Please tell me how I can help and what is already done so we can get this to Linux users ASAP. Data, Date, UUID are simple and I've implemented them before so those would be starters. But really the work is done in the Swift Darwin Foundation overlay, so its just a matter of making some Linux-specific changes, and removing the ObjC bridging. |
https://github.com/apple/swift-corelibs-foundation/tree/swift-3 already has the value types on linux, this branch will be merged soon to master |
And ReferenceConvertible is on linux, it just cannot adopt _ObjectiveCBridgeable since that does not exist. However there is nothing stopping the bridge usage of those types for implementing those methods since the basic functionality of the methods needed for _ObjectiveCBridgeable work just fine on any platform. |
@phausler, Ok thanks. Also, I see NSUUID is not converted to Swift 3, could I work on that today? https://github.com/apple/swift-corelibs-foundation/blob/swift-3/Foundation/NSUUID.swift |
UUID has some cross platform strangeness since it uses the Darwin uuid type, we have to make certain there is parity there to the overlay version. So you would need to drop the _ObjectiveCBridgeable and also figure out how we could import the uuid library correctly on linux |
I have used https://github.com/PureSwift/CUUID in the past, but that won't be acceptable for this implementation. I have also tried to have a PR accepted to the Swift repo to fix this, but that was denied apple/swift#276 . I can adapt the code to use the Unix UUID library, basically copy the Swift Darwin Foundation overlay, and then we can work on importing that lib on Linux. @phausler Sounds good? |
@phausler @belkadan Submitted PR to Swift for importing UUID library. apple/swift#3095 |
@phausler Could you comment on this PR please? apple/swift#3095 (comment) I believe it would solve the issue for importing libUUID on Linux. |
Made a cleaner PR for CUUID apple/swift#3107 |
Comment by Paulo Ricardo Lopes de Faria (JIRA) Is anybody working on Data? |
Data is already done. https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/Data.swift |
Comment by Paulo Ricardo Lopes de Faria (JIRA) @phausler Unfortunally Data is not in pair with macOS implementation. It doesn't implement RangeReplaceableCollection on Linux, and maybe some other methods. See the log: https://circleci.com/gh/QuarkX/Quark/274 The macOS counterpart passes without issues https://travis-ci.org/QuarkX/Quark/builds/154232385 So the API is not the same. |
Hmm looks like when the latest updates for struct Data were imported it seems like that protocol was elided. It may have been due to a compiler crash or some other misbehavior. APIs in many cases will never be 100% the same (e.g. virtualMemory Deallocators won't be something that can be done reliably in a cross platform manner), however the protocol in question just looks like it was omitted. |
I re-imported a few things that were missing: |
Already implemented in Swift 3 |
Additional Detail from JIRA
md5: b443e427e2a021adcf3fd47521379381
Issue Description:
I would like to start the process of implementing SE-0069 for Linux.
Date, Data and UUID would be the first targets.
I previously did this in https://github.com/PureSwift/SwiftFoundation but now since the Swift Team has accepted this behavior, I want to get to work to make that available for all Swift users.
The text was updated successfully, but these errors were encountered: