[swift-evolution] When to use argument labels, part DEUX

Dave Abrahams dabrahams at apple.com
Sun Feb 7 23:37:12 CST 2016

on Sun Feb 07 2016, plx <swift-evolution at swift.org> wrote:

>> On Feb 6, 2016, at 11:31 PM, Dave Abrahams via swift-evolution
>> <swift-evolution at swift.org> wrote:
>> on Sat Feb 06 2016, plx <swift-evolution at swift.org> wrote:
>>> I do find some of the rules worded in ways that are hard to apply in
>>> the presence of trailing nouns; I’m not sure the guidelines are strong
>>> enough here to force the “right” outcome.
>>> Consider this example:
>>> // not-intended: 
>>> a.tracksWithMediaCharacteristic(b, composer: c)
>>> …applying our guidelines:
>>> - `tracks with media characteristic b` is a grammatical phrase
>> I went through a series of thoughts on this:
>> 1. I'm not sure it is grammatical (I'll have to consult with a
>>   linguist).
>> 2. I understand why it sounds natural: this is the somewhat misleading
>>   result of using a single-character identifier in the example.  It's like
>>   talking about a hypothetical "person A" and "person B".  You wouldn't think
>>   "Person Joe"  was grammatical.
>> 3. Yeah, but "umbrellas with color yellow" is perfectly fine, if
>>   slightly unnatural, and it has the same grammatical structure.  My
>>   wife points out that it's like something you would say in poetry to
>>   make rhyme or meter work.
>> 4. Again I need to consult with a linguist, but I now have hope that it
>>   actually is grammatical, meaning the whole “skipping trailing nouns
>>   on the base name” wrinkle can be eliminated from the guidelines.
>>   Thanks!
> It’s a good example of “grammaticality vs acceptability” issues; for
> another other example, “The Color Purple”.  Even “Person Joe” is ok in
> the right context, but as it’s unusual and tricky to parse it
> seemingly requires a pause (or a comma when written), e.g. consider
> “The person, Joe, bit the dog, Fido”.

Yep; great points.

> For the above example, I think there’s a strong sense that the
> phrasing is unusual, and the lack of articles isn’t helping; I’d order
> the acceptability like this:
> tracks with the “legible” media-characteristic // <- most-natural/least-unusual
> tracks with the media-characteristic “legible”
> tracks with media-characteristic “legible”
> tracks with “legible” media-characteristic // <- worst due to interpretational ambiguity 

Well, and the lack of quotation marks in the name doesn't help either.
But when you s/legible/X/ I'd say the third one is perfectly natural and
the other ones are all a bit strange.

> …and I think the the perceived acceptability improves
> substantially—and seemingly uniformly—with some more context:
> let t = (all of a's) tracks with the “legible” media-characteristic
> let t = (all of a's) tracks with the media-characteristic “legible”
> let t = (all of a's) tracks with media-characteristic “legible”
> let t = (all of a's) tracks with “legible” media-characteristic // <- still the worst, for the same reason
> …which sort of situation was why I thought it was risky to put too
> much weight on grammatical rules in the guidelines: I suspect that a
> lot of what needs to be “ungrammatical” for the guidelines will in
> practice be closer to “questionable”, 

Can you explain what you mean by "needs to be “ungrammatical” for the

> and it can be difficult to keep one’s sense of the “questionable”
> calibrated; this is especially true if you spend a lot of time exposed
> to “odd" language, e.g. English-like source code.

Heh, indeed.  That's why I think it's better to have a solid criterion
like “is it grammatical?” than to use something like “is it questionable?”

> Given the perceived oddness of the trailing-noun usage, the best
> rule-adjustment might be “is it a complete phrase? If there’s a
> trailing noun, you may *either* ignore the trailing noun *or* ignore
> the argument—but not both—when making that decision,” except pithier.

I wonder if “use single-letter identifiers to evaluate grammaticality at
a hypothetical use-site” is an approach that would work without any

I think we might also want to consider it legitimate to evaluate calls
taking enum parameters using actual enum case names, as they can account
for a lot of words and can be controlled to make calls read


More information about the swift-evolution mailing list