[swift-evolution] [SE-0011] Re-considering the replacement keyword for "typealias"
sean at fifthace.com
Wed Dec 23 10:00:44 CST 2015
I don’t understand this argument about googleability of “type” being a problem. All of the errors and documentation talk about “associated type” and having the word “type” literally visually associated with the word “protocol” right there in the code I’m looking at makes perfect sense to me.
Since all of the error messages say “associated type”, I’d be googling a phrase that includes the error message somehow such as “swift associated type” or “swift protocol type” or something else and I’d almost certainly land on the right documentation no matter what the keyword is.
The keyword doesn’t matter much as long as the error messages can be searched for.
All that said, though, the single most confusing aspect of associated types, for me, was that “typealias” allowed me to specify a default type - and because of that *one* thing, I initially thought it behaved exactly like “typealias” when outside of a protocol and did not understand the relationship for quite awhile. Frankly, I think this whole mess *could* be solved simply by not allowing “default” types when using the typealias keyword in a protocol. In that case, attempting to do so would generate an error, and then searching for that error would lead to an explanation of what “typealias” really means when inside of a protocol and a whole ton of confusion could be avoided from the start - without changing any keywords.
> On Dec 22, 2015, at 10:54 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>> I don’t see any problem in referring to the feature as associated types, but then having the syntax be just plain “type”.
> I think it's been said before, but the problem with using a `type` keyword is that if you type "swift type" into Google (or any other search feature you might use for documentation), you're probably not going to get information about this feature specifically. "swift associated" or "swift associatedtype" are more likely to give you what you want.
> Brent Royal-Gordon
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution