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

plx plxswift at icloud.com
Sun Feb 14 14:11:54 CST 2016


As the conversation has moved on really far now I only have a couple minor things here.

> On Feb 7, 2016, at 11:37 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> 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.

Contrast with "users with the ‘suspended' account-status” vs “users with the suspended account-status” vs “users with suspended account-status” vs “users with account-status suspended”. 

> 
>> …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
> guidelines?”

In hindsight that is rather terse!

My assumption is the guidelines are meant to steer users to make some decisions and not others, and my other assumption is that “is this grammatical (Y/N)” isn’t actually strong enough to do that steering (many more short sequences of words are technically grammatical than one might wish).

But, there’s not a better phrasing than “forms a grammatical phrase”, either; you can’t realistically write “forms a grammatical phrase (that also isn’t weird, hard to parse, or otherwise unusual)”, even if that’s closer to the spirit of the steered-toward decisions.

That was what I meant; the discussion’s moved on enough not much point continuing this specific point any further.

> 
>> 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
> “ignoring?”

I think it might, worth a try at least.

> 
> 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
> grammatically.
> 
> -- 
> -Dave
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list