[swift-evolution] When to use argument labels (a new approach)

Matt Whiteside mwhiteside.dev at gmail.com
Wed Feb 3 23:19:33 CST 2016


See my response down below

> On Feb 3, 2016, at 17:32, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Wed Feb 03 2016, Matt Whiteside <swift-evolution at swift.org> wrote:
> 
>> I’m in agreement with what Ricardo is saying here:
>> 
>>> I personally like it and I agree with all except the following:
>>> 
>>> let p = someFont.glyph("propellor")
>>> let p = someFont.glyphWithName("propellor”)
>> 
>> To be more specific, this example looks good to me:
>> a.transitionToScene(.GreatHall)               // yes
>> 
>> but this one:
>> let p = someFont.glyph("propellor")           // yes
>> 
>> somehow doesn’t.  Maybe because it reads more like subscripting a
>> dictionary.  As a result, I think this second example kind of detracts
>> from this section of the guidelines.
> 
> I wonder if it looks better written like this?
> 
>  let p = someFont.glyph("LATIN SMALL LETTER A WITH ACUTE")
> 
> "propellor" was the argument in an example of this method in use that I
> could find on the web, but it's a really odd way to spell that word.
> Maybe it has something to do with that.


I don’t think I’m understanding the difference.

At the risk of distracting you with minutiae, this particular example feels more like a property access than a method call, so my mind wants to rewrite it as this:

someFont.glyphs[“LATIN SMALL LETTER A WITH ACUTE”]

and that makes it a little harder to stay focused on the intent of the guideline.

Matt




More information about the swift-evolution mailing list