Skip to content
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

Closed
colemancda opened this issue Jun 14, 2016 · 20 comments
Closed

[SR-1756] Implement SE-0069 Foundation Value Types for Linux #4140

colemancda opened this issue Jun 14, 2016 · 20 comments
Assignees

Comments

@colemancda
Copy link
Contributor

Previous ID SR-1756
Radar None
Original Reporter @colemancda
Type Task
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Task
Assignee @colemancda
Priority Medium

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.

@belkadan
Copy link

I believe @phausler already has some of this ready to go, using the Darwin implementation. Philippe?

@colemancda
Copy link
Contributor Author

@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.

@belkadan
Copy link

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!

@colemancda
Copy link
Contributor Author

@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.

@phausler
Copy link
Member

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

@phausler
Copy link
Member

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.

@colemancda
Copy link
Contributor Author

@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

@phausler
Copy link
Member

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

@colemancda
Copy link
Contributor Author

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?

@colemancda
Copy link
Contributor Author

@phausler Added PR for UUID type #417

@colemancda
Copy link
Contributor Author

@phausler @belkadan Submitted PR to Swift for importing UUID library. apple/swift#3095

@colemancda
Copy link
Contributor Author

@phausler Could you comment on this PR please? apple/swift#3095 (comment)

I believe it would solve the issue for importing libUUID on Linux.

@colemancda
Copy link
Contributor Author

Made a cleaner PR for CUUID apple/swift#3107

@swift-ci
Copy link
Contributor

Comment by Paulo Ricardo Lopes de Faria (JIRA)

Is anybody working on Data?

@phausler
Copy link
Member

@swift-ci
Copy link
Contributor

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.

@phausler
Copy link
Member

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.

@phausler
Copy link
Member

I re-imported a few things that were missing:

#583

@colemancda
Copy link
Contributor Author

Already implemented in Swift 3

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants