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


_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to