[swift-evolution] [SE-0011] Re-considering the replacement keyword for "typealias"
Stephen Celis
stephen.celis at gmail.com
Sun Dec 20 10:27:02 CST 2015
> On Dec 19, 2015, at 11:14 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>
>> On Dec 19, 2015, at 5:09 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> I don't think `required` captures the intended meaning *at all*. You're not required to declare the type of a "required typealias"—it's often, perhaps even usually, inferred.
>
> No, but it is required to exist and can't always be inferred. It puts a constraint on the type that is declared to conform. This is a requirement in exactly the same sense that other protocol requirements are requirements. Notably operator requirements may be satisfied "implicitly" by declarations that already exist, but they are still requirements.
I think reusing "required" here (where "typealias" has already been reused) could make the concept of associated types more opaque to new users.
The use of "typealias" as a kind of "typedef" immediately made sense to me. When I first stumbled upon "typealias" in a protocol, it took me some time to fully grok its use and its connection to its "typedef" counterpart.
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151220/63f0b0e9/attachment.html>
More information about the swift-evolution
mailing list