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

Add Sendable conformance to Xoshiro and LCRNG generators #28

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

seanmrich
Copy link

The current implementation of swift-gen supports back to swift 5.0. However, with the release of swift 6.0 the Sendability requirements have become more strict. An example for this project is using the generators with the withRandomNumberGenerator dependency in the swift-dependencies package. Using e.g. Xoshiro raises an error:

withDependencies {
  $0.withRandomNumberGenerator = WithRandomNumberGenerator(Xoshiro(seed: 0))
// Type 'Xoshiro' does not conform to the 'Sendable' protocol 👆
}

All that's required is the declaration for the included generators to support sendability.

Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This library could definitely use some updates, so we appreciate the time!

@stephencelis
Copy link
Member

stephencelis commented Sep 25, 2024

@seanmrich Do you have time to look into updating the Linux CI to point to a more recent Swift to get this PR green? (If not, no worries, we can take a look!)

@seanmrich
Copy link
Author

Looks like the error was related to the Docker image using swift 5.3, but my PR increased the requirement to swift 5.5 to get Sendable. Added a commit to restore the tools version to 5.0 and instead put the Sendable conformance behind a swift version check.

Note that the conformance added on LCRNG creates a warning because the type is deprecated. Not sure if you want to remove conformance since it's deprecated anyway just to remove the warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants