[swift-evolution] [Pitch] Expanded type category constraints

Russ Bishop xenadu at gmail.com
Wed Oct 26 20:56:05 CDT 2016


Do we already have a proposal for expanding constraints to support categories beyond class? I am guessing this might have ABI stability concerns, or at least library resilience concerns.

If so and no one else has tackled it I’m happy to write up a proposal. There are only a couple that I know of:

valuetype
Only struct and enum types would satisfy this constraint.

valuetype(pure)
A struct or enum that contain no reference types at all. The only reason to add this would be allowing certain optimizations, though the way existentials work today I’m not sure if this is even possible because the calls to value witnesses need to be emitted anyway.

functiontype
A function type. This doesn’t have much use today but eventually we could expand this to support reflecting the number and type of arguments, dynamically invoking, etc.



If there aren’t any ABI or resilience concerns then we can shelve it. I created https://bugs.swift.org/browse/SR-3056 <https://bugs.swift.org/browse/SR-3056> to track the idea in either case.

Russ


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161026/877fc639/attachment.html>


More information about the swift-evolution mailing list