[Pitch] Elide `some` in Swift 6

You're mistaken: there really is in fact a typealias declaration with an actual, honest-to-goodness, right-hand side; it's just that it must be censored by SymbolGraphGen because it refers to a built-in:

public typealias AnyObject = Builtin.AnyObject

I wouldn't call it a fiction; it's the user-facing language model, which glosses over implementation details that we deliberately don't want to make the concern of the end user.

It also isn't something invented by the documentation. Until 2017, AnyObject was literally declared as a protocol:

#if _runtime(_ObjC)
@objc
public protocol AnyObject : class {}
#else
public protocol AnyObject : class {}
#endif

(And even when it was declared as such, there were special-cased checks in the compiler to stop you from extending it with new methods, or declaring a retroactive conformance to it, etc.)

A very involved series of PRs revised the underlying implementation such that the declaration assumed its present form as a type alias (if I recall correctly, this was around the time when we decided to deprecate the class syntax in favor of AnyObject).


On both this point and the preceding one, I've already replied at length in the relevant thread, so I'll just point you there instead of further derailing this one:

Let's focus here on only any salient points that would relate to eliding some.

3 Likes