[swift-evolution] [Guidelines, First Argument Labels]: Prepositions inside the parens
jordan_rose at apple.com
Thu Feb 11 15:21:36 CST 2016
+1. It's not whether the "of" is on its own or not, it's whether it's describing the base noun or extracting something from it.
tiffFile.removeImageRepresentation(ofSize: CGSize(width: 16, height: 16)) // hypothetical, importer default would be "of:" but that looks wrong
tabView.frameOf(subview: contentView) // hypothetical, could go either way?
> On Feb 11, 2016, at 11:57, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> Huge improvement overall moving the 'of'. However, these and related
> functions stand out as regressing in clarity:
> - class func userFont(ofSize fontSize: CGFloat) -> NSFont?
> - class func userFixedPitchFont(ofSize fontSize: CGFloat) -> NSFont?
> + class func userFontOf(size fontSize: CGFloat) -> NSFont?
> + class func userFixedPitchFontOf(size fontSize: CGFloat) -> NSFont?
> My rationalization: here, 'of' is being used differently than in other
> places. In fact, userFont(ofSize:) could be equally renamed
> userFont(withSize:) or userFont(havingSize:).
> On Thu, Feb 11, 2016 at 1:35 PM, Douglas Gregor via swift-evolution
> <swift-evolution at swift.org> wrote:
>>> On Feb 11, 2016, at 10:53 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>> on Thu Feb 11 2016, Charles Kissinger <swift-evolution at swift.org> wrote:
>>>> FWIW, I think these new guidelines strike a very nice balance between
>>>> all of the competing concerns. The result of applying them to some of
>>>> my own code could best be described as “different but not unpleasant”
>>>> In looking over the diffs, one nice result I didn’t expect is that
>>>> moving the prepositional phrases into the first argument label seems
>>>> to increase the speed with which I absorb the general intent of a
>>>> function -- the “at a glance” understanding -- by moving a “detail”
>>>> (important as it might be) into the parameter list. (The split
>>>> prepositional phrases had the opposite effect for me.)
>>> That's nice! What do you think about moving “of” back out of the
>>> parens? Does that help or hurt?
>> And lo!, a diff appeared!
>> - Doug
>> swift-evolution mailing list
>> swift-evolution at swift.org
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution