[swift-evolution] [SE-0011] Re-considering the replacement keyword for "typealias"

Joe Groff jgroff at apple.com
Mon Dec 21 20:56:54 CST 2015


> On Dec 21, 2015, at 6:34 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> 
>> On Dec 21, 2015, at 4:57 PM, Jordan Rose via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> 
>>> On Dec 20, 2015, at 3:58 , Tino Heth via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> 
>>> 
>>>> The main reason to use `associated` is because the feature is called an "associated type". If we're willing to rename the feature to "placeholder type", then `placeholder` would be a good keyword.
>>> good point - maybe it's because I'm no native speaker, but for me "associated type" is just a technical term with no obvious meaning.
>> 
>> Fair enough; "associated type" is a fairly vacuous term. I think the implication is that when you choose a model of the protocol, the concrete type, then these other types come along with it. But that's not immediately clear, so I don't think renaming the feature is out of the question.
>> 
>> I don't like the name "placeholder" or "placeholder type" because that only describes how they're used in the protocol. When you're actually implementing a generic function, the generic parameter is a sort of placeholder, and the associated types are just as concrete as the conforming type itself.
> 
> I’m actually coming around to wanting it to be just “type” as a contextual keyword, if we can make that work.  The point is that these types aren’t “associated” in any way that distinguishes them from other requirements on nested declarations, i.e. funcs and vars.

Yeah, if we could make 'type' work I'd prefer that too. None of our other protocol requirement declarations specifically call out the fact that they're protocol requirements, so it feels a bit weird to use a name like 'associatedtype' or 'requiredsomething' that belabors the relationship between the protocol and the requirement.

-Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151221/89c5eaa7/attachment.html>


More information about the swift-evolution mailing list