GRDB.swift icon indicating copy to clipboard operation
GRDB.swift copied to clipboard

Conform Database.ColumnType to Sendable

Open simba909 opened this issue 1 year ago • 3 comments

First up, thank you for making this! 🙏🏻 I have used GRDB in quite a few projects throughout my career now and it's a go-to tool for me. Making my first contribution to it a fairly minor improvement :)

This silences a (couple of, due to the static lets) warning when building GRDB with strict concurrency checking enabled. Database.ColumnType is RawRepresentable as a String (which also is Sendable) and its rawValue cannot change, making this a safe conformance.

Please let me know if there are things I have missed or if this can be done in a better way!

Pull Request Checklist

  • [x] CONTRIBUTING: You have read https://github.com/groue/GRDB.swift/blob/master/CONTRIBUTING.md
  • [x] BRANCH: This pull request is submitted against the development branch.
  • [ ] DOCUMENTATION: Inline documentation has been updated.
  • [ ] DOCUMENTATION: README.md or another dedicated guide has been updated.
  • [x] TESTS: Changes are tested.
  • [x] TESTS: The make smokeTest terminal command runs without failure.

simba909 avatar Mar 08 '24 13:03 simba909

Hello @simba909,

Thank you for this contribution! A big review of sendability is indeed necessary now that Swift concurrency is entering a "serious" phase. I'm far away from any computer, so please wait a few days for a proper answer!

groue avatar Mar 09 '24 14:03 groue

Totally agree that a bigger review is necessary, pardon the potential rudeness of only addressing this initial warning. Let me know of what I can do to help 🙂

Hope you're having a great time off (or at least away from your computer) 👍🏻

simba909 avatar Mar 11 '24 09:03 simba909

Don't worry. I'm glad you could fix a warning in this PR. Some warnings are more challenging to address (https://github.com/groue/GRDB.swift/discussions/1492). Add to that a language that is a moving target, emits false positive warnings, and has bugs and obscure subtleties regarding @preconcurrency... Some time, dedication, discussions on the Swift forums are needed 😅

groue avatar Mar 11 '24 12:03 groue

Thank you @simba909, this will ship in the next release :-)

groue avatar Mar 17 '24 13:03 groue

Shipped in v6.26.0

groue avatar Mar 23 '24 13:03 groue