This is a random thought and I'm not sure where the discussion will lead to. Semantically we can represent
Never? implies that we 'never return a value', where the returned value is
.none which represents 'nothing' in the semantical context. Therefore
() -> Never? is a function that returns nothing or in other words never returns a value. This is either what
Void semantically means or overlaps it fairly well.
I wonder if we could flip
Void like so:
typealias Void = Never?
As a bonus
Void will automatically become
Never conforms to those protocols and
Optional conditionally conforms to them when
Sure there are some strange implications such as:
return nilwill become possible everywhere where we expect
- I'm not sure how to deal with the empty tuple literal
()to keep source compatibility
- The compiler might need to optimize memory layout size for
0as it already does for enums with a single case.
Therefore this is a discussion so we can observe different opinions about this wild idea.