Tuesday, December 13, 2022

Swift Pitch: Predicates

Jeremy Schonfeld:

We propose creating a new value type, Predicate, as part of the FoundationEssentials package, that addresses these problems. These new constructions of predicates will be expressed using standard Swift syntax elements and are fully type-checked by the compiler. This allows us to design Predicate to be type safe, readily archivable and Sendable, and integrated with Swift development environments.

Aside from type-safety with respect to the object being tested, this could also potentially address the problem where it’s not clear which APIs support which types of NSPredicates.

Debbie Goldsmith and Jeremy Schonfeld:

The current design proposes that any developers that need to expand or restrict the set of allowed expressions in their predicate-accepting APIs need to declare their own predicate types with corresponding macros.

Previously:

Comments RSS · Twitter

Leave a Comment