groue / GRDB.swift

A toolkit for SQLite databases, with a focus on application development
MIT License
6.61k stars 677 forks source link

Conform Database.ColumnType to Sendable #1503

Closed simba909 closed 3 months ago

simba909 commented 4 months ago

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

groue commented 4 months ago

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!

simba909 commented 4 months ago

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) 👍🏻

groue commented 4 months ago

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 commented 3 months ago

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

groue commented 3 months ago

Shipped in v6.26.0