[Pitch] Introduce existential `any`

I agree with this. It's not going to be obvious to many users that any creates a distinct type, while some does not.

protocol Food {}

// 'some Food' is not a distinct type.
// It is just an anonymization of some known type
var food1: some Food { Pizza() }

// 'any Food' is a distinct type, despite
// syntactic similarity with 'some Food'
var food2: any Food  { Pizza() }

// This is clearly a distinct type
var food3: Any<Food> { Pizza() }

I think that we're going to have a lot of users confused about a misleading similarity between some and any. I think that would be a lot less likely if we used Any<T>.

Anyway, we've had discussions about this before, and overall I think either spelling of existential is better than leaving them bare like we have right now. But I did want to call out the discussion here.

3 Likes