[swift-evolution] Proposal: An Either Type in the STL

John McCall rjmccall at apple.com
Thu Dec 10 20:14:24 CST 2015

> On Dec 10, 2015, at 6:05 PM, Joe Groff <jgroff at apple.com> wrote:
>> On Dec 10, 2015, at 5:59 PM, Matthew Johnson <matthew at anandabits.com> wrote:
>>> Structural sum types containing dependent types.
>> Dependent in what sense?  Swift doesn't support anything like dependent types in the usual sense of being dependent on a value (modulo the pretty limited ability to abuse the type system).
> I think John means 'dependent' in the more prosaic C++ sense of 'dependent on generic type parameters', e.g. 'Array<T>' inside a function generic on <T>, not dependent types in the Coq/Agda/Idris sense.

Right, sorry; I’ve gotten too used to the C++ sense.  I mean types which contain free uses of the generic parameters of the context, which therefore appear to be opaque there.  It’s a problem for union typing because the intersection of any opaque types with the other concrete types in a union is not necessarily empty.  It’s not an unsolvable problem, of course.


More information about the swift-evolution mailing list