<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 26, 2016, at 6:34 PM, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">on Tue Jan 26 2016, plx <</span><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">> wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class="">On Jan 24, 2016, at 5:57 PM, Dave Abrahams via swift-evolution<br class=""><<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""><br class="">on Sat Jan 23 2016, plx <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></blockquote><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Jan 23, 2016, at 2:33 PM, Dave Abrahams via swift-evolution<br class=""><<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""><br class="">on Sat Jan 23 2016, plx<br class=""></blockquote><br class=""><blockquote type="cite" class=""><<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><<a href="mailto:swift-evolution@swift.org" class="">mailto:swift-evolution@swift.org</a>>> wrote:<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Jan 22, 2016, at 6:12 PM, Ross O'Brien via swift-evolution<br class=""><<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">How would we apply this to delegate patterns?<br class="">For example, would we keep<br class="">tableview(tableView:cellForRowAtIndexPath:), or would we switch to<br class="">delegate(tableView:cellForRowAtIndexPath:) ?<br class="">Or perhaps better, for clarity over which protocol is being<br class="">conformed to / which property of the delegator is calling the<br class="">function:<br class="">dataSource(tableView:cellForRowAtIndexPath:),<br class="">delegate(tableView:didSelectRowAtIndexPath:)<br class=""></blockquote><br class="">FWIW, I am personally favorable to a more radical-renaming for<br class="">delegate methods, roughly the below:<br class=""><br class="">func numberOfSections(inTableView tableView: UITableView) -> Int<br class="">// <- against guidelines, but symmetric<br class="">func numberOfRows(inTableView tableView: UITableView, forSection section: Int) -> Int<br class="">func cellForRow(inTableView tableView: UITableView, atIndexPath<br class="">indexPath: NSIndexPath) -> UITableView<br class=""></blockquote><br class="">The interesting thing about delegate methods is that, for the most part,<br class="">use-sites don't appear in user code. So *if* you're going to come up with<br class="">special conventions just for delegate methods you'd want to serve the<br class="">declaration site. I don't know what these things *ought* to look like,<br class="">but the declarations above look to me like they've got an awful lot of<br class="">redundancy that doesn't help readability.<br class=""></blockquote><br class="">Most of what follows should really be in the discussion about the<br class="">Objective-C import, not here, but I’ll respond here with the parts<br class="">relevant to the guidelines.<br class=""><br class="">It seems self-evident that imported delegate methods violate the<br class="">spirit of Swift’s API guidelines; in particular, the rule that<br class="">“Methods can share a base name when they share the same basic meaning<br class="">but operate on different types, or are in different domains” seems<br class="">relevant.<span class="Apple-converted-space"> </span><br class=""></blockquote><br class="">That's quite true.<br class=""><br class=""><blockquote type="cite" class="">It’s thus been a bit surprising to me that delegate-style methods<br class="">haven’t *already* gotten some special treatment;<span class="Apple-converted-space"> </span><br class=""></blockquote><br class="">Well, it's a fact of life that major efforts like this one (probably<br class="">property behaviors are the same bucket) are going to have to land<br class="">without solving all the problems they are related to. I believe<br class="">strongly that we should do *something* about delegate methods. I also<br class="">believe they're a separable problem and we should be able to evaluate<br class="">the current direction without working out all the details of how we're<br class="">going to handle them. That's why I changed the subject line: I'd like<br class="">to agree that special treatment for delegate methods in the importer is<br class="">out-of-scope in this review.<br class=""><br class=""><blockquote type="cite" class="">what I had isn’t great, but put it and some variants up against the<br class="">original, like so:<br class=""><br class="">func numberOfRows(in tableView: UITableView, forSection section: Int) -> Int<br class="">func numberOfRowsIn(tableView: UITableView, forSection section: Int) -> Int<br class="">func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int<br class="">func numberOfRows(inTableView tableView: UITableView, forSection section: Int) -> Int<br class=""></blockquote><br class="">I assume you mean the 3rd one to be "the original?”<br class=""></blockquote><br class="">Yes, here: tableView(_:numberOfRowsInSection:)<br class=""><<a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDataSource_Protocol/#//apple_ref/occ/intfm/UITableViewDataSource/tableView:numberOfRowsInSection:" class="">https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDataSource_Protocol/#//apple_ref/occ/intfm/UITableViewDataSource/tableView:numberOfRowsInSection:</a>><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">…(note the longest is only ~10 characters longer than the shortest!).<span class="Apple-converted-space"> </span><br class=""></blockquote><br class="">Sorry, I don't see why that is relevant. Care to explain?<br class=""></blockquote><br class="">I did not make the intention clear; apologies. I was intending to<br class="">illustrate that although all of the examples contain redundancies,<br class="">none of them are egregiously worse than the others (including the<br class="">original); the worst case is only moderately more-redundant than the<br class="">best case.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I understand that, but if you'll forgive me for being blunt, so what?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>At the time I thought you meant simply that:</div><div><br class=""></div><div>- that the suggestion was annoyingly verbose and redundant</div><div><br class=""></div><div>…which seemed an odd criticism, given that “the original” was similarly verbose-and-redundant; however, I think you may have been thinking:</div><div><br class=""></div><div>- that because said suggestion was not appreciably-less-redundant than "the original", it’s hard to justify such a transformation (more work for marginal benefit)</div><div><br class=""></div><div>…in which case we have may have simply been talking past each other.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">Although there might be an as-yet unseen option that’s superior to all<br class="">of the above, just out of those 4 it’s hard to see how you can justify<br class="">option #3 using the API guidelines;<span class="Apple-converted-space"> </span><br class="">it also seems hard to envision a self-consistent expansion of the<br class="">guidelines that’d lead to favoring #3.<br class=""></blockquote><br class="">You can't.<br class=""><br class=""><blockquote type="cite" class="">As already noted this is really more-relevant to the “objective-c<br class="">import revision”, but you can frame my points as obliquely asking “to<br class="">what extent should the Swift API guidelines actually matter when doing<br class="">the big Objective-C import?”<br class=""></blockquote><br class="">We're willing to accept that some imported APIs will not follow the<br class="">guidelines.<br class=""><br class=""><blockquote type="cite" class="">I also question your sense of real-world use of delegate protocols;<br class="">just taking inventory of the most recent project I completed, it looks<br class="">like it had 5 custom delegate-style protocols. Of these, 4 had exactly<br class="">one implementation each, and 1 had exactly 2 implementations;<span class="Apple-converted-space"> </span><br class=""></blockquote><br class="">And how many use-sites were there?<br class=""></blockquote><br class="">5, just counting “classes using said delegates”; 14 if you go by<br class="">individual method use.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">My point is that with most methods, the use sites clearly overwhelm the</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">declaration sites. I don't believe that to be the case with delegates.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">But this is really a minor detail.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>For the “SDK” protocols from Apple this is of course true; on the other hand, most one-off, in-app protocols are declared once, used once, and implemented at-most a couple times (1 being the mode, I’d imagine).</div><div><br class=""></div><div>TBH I wouldn’t have noticed the oddity in delegate-style APIs if I hand’t had to create a few one-off ones and noticed how *odd* it is.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">I don’t think this is that untypical. If you accept it as not too<br class="">atypical,<br class=""></blockquote><br class="">I do.<br class=""><br class=""><blockquote type="cite" class="">it suggests a more uniform balance between defining a delegate<br class="">protocol, using said protocol, and implementing said protocol.<br class=""></blockquote><br class="">Not necessarily. How many times did this project implement delegate<br class="">protocols that were defined elsewhere? <br class=""></blockquote><br class="">Looks like 12, for implementations; “a lot”, going by by the method<br class="">count.<br class=""><br class="">In any case I don’t dispute the general point, just perhaps the exit.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>I meant to type `extent`; apologies.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class="">In any case, for what it's worth, I personally think the direction<br class="">you're going with those delegate APIs is great, and it has the benefit<br class="">of bringing them into conformance with other guidelines. My only point<br class="">in saying that the declaration site is more important with delegate<br class="">methods than with others is that there's more type information at the<br class="">declaration site of a method than at its use site, so there's definitely<br class="">no reason to make them more verbose than others. Making them simply<br class="">follow the existing guidelines exactly is a simple solution that IMO<br class="">leads to good code, and one I would support.<br class=""><br class="">However, what Cocoa guys like Tony Parker say about the eventual<br class="">direction of delegate APIs should probably carry a lot more weight than<br class="">what I say.<br class=""><br class=""><blockquote type="cite" class="">To wind this digression down now, the API guidelines’ attitude towards<br class="">redundancy seems somewhat troubling; no one wants needless redundancy,<br class="">but natural languages tend towards redundancy (cf<br class="">agreement/pleonasm/etc) and it’s not at all self-evident that less<br class="">redundancy always implies increased readability (which you may or may<br class="">not be intending to imply; I can’t tell)…especially when it’s easy to<br class="">get fooled by increased speed-of-reading.<br class=""></blockquote><br class="">This seems like a pretty vague concern. Let's see concrete examples of<br class="">problems you think the guidelines' attitude toward redundancy will<br class="">cause. FWIW, "omit needless words" isn't something we just came<br class="">up with ourselves: it's a time-honored principle of clear English<br class="">writing (google it).<br class=""></blockquote><br class="">Sure, sure, but if you’ll forgive a cheap shot I’d point out Strunk<br class="">would’ve tut-tutted here and suggested, perhaps, “we didn’t invent<br class="">‘omit needless words’”. The tricky part of that rule is that what’s<br class="">needless is highly contextual, and to be *understood* when writing in<br class="">a highly-condensed style usually requires a large amount of shared<br class="">context.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Oh, that *was* cheap; and I'm not sure I can forgive it! :-)</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>I only felt justified taking it b/c “came up with ourselves” is at least a borderline pleonasm.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Which need-for-context is at the root of my admittedly-vague concern;<br class="">I’ve done my best to come up with a concrete-ish example, but it’s a<br class="">bit contrived and not as strong as I’d like, either. It’s more of an<br class="">"ecosystem concern”, too.<br class=""><br class="">Here are *six* functions that could conceivably be named `min` under the guidelines:<br class=""><br class="">func min() -> Generator.Element? // obviously only where `Generator.Element` is `Comparable`<br class="">func min(isLessThan comparator: (Generator.Element,Generator.Element)<br class="">-> Bool) -> Generator.Element?<br class="">func min<K:Comparable>(extractor: (Generator.Element) -> K) -> K?<br class="">func min<K:Comparable>(extractor: (Generator.Element) -> K?) -> K?<br class="">func min<T>(extractor: (Generator.Element) -> T, isLessThan comparator: (T,T) -> Bool) -> T?<br class="">func min<T>(extractor: (Generator.Element) -> T?, isLessThan comparator: (T,T) -> Bool) -> T?<br class=""><br class="">…and perhaps they *all* should be named `min` (and we simply let<br class="">context and type information sort it all out for us).<br class=""><br class="">But if the names should be different, what’re good choices?<br class=""><br class="">My vague concern is that having “maximally-terse” names for the<br class="">standard library functions makes it trickier to choose<br class="">"non-misleading” names for such closely-related variants.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">We are not going for maximal terseness in the standard library. When we</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">pick a name like "min" it's because of precedent and expectations.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="">EG: if you go with `minValue` for the variants, to a casual reader<br class="">there’s room for confusion vis-a-vis `min` (I suspect many would<br class="">initially guess that `minValue` does what `minElement` does today, but<br class="">would guess the behavior correctly if given a choice between<br class="">`minElement` and `minValue`).<br class=""><br class="">Unfortunately for my case, I think `minFor` is a perfectly-reasonable<br class="">choice here, which undermines my concrete example (I warned you the<br class="">case wasn’t going to be very convincing).<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It is just as you said :-)</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">But that’s the kind of vague concern I have here: that a<br class="">“maximally-terse” naming convention can be harder to extend in a way<br class="">that’s both self-consistent and not-potentially-misleading.<br class=""><br class="">But I don’t have a great suggestion for an additional guideline, and<br class="">there may be nothing serious to worry about here, either.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I think we've made it very clear that we're not going for maximal</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">terseness:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> Clarity is more important than brevity. Although Swift code can be</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> compact, it is a non-goal to enable the smallest possible code with</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> the fewest characters. Brevity in Swift code, where it occurs, is a</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> side-effect of the strong type system and features that naturally</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> reduce boilerplate.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">—<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>I understand you don’t think you’re going for maximal terseness, but guidelines aimed at redundancy-reduction with a lack of concern for what the linguists call “markedness” (which is amongst other things context-dependent, and thus not easy to judge in isolation).</div><div><br class=""></div><div><div>Specifically, what counts as “weak type information” will always be somewhat context-dependent. Here’s another example, this time drawn from the Objective-C import proposal: `documentFor(url: NSURL)`.</div><div><br class=""></div><div>`documentFor(url: NSURL)` is certainly in conformance to the current guidelines.</div><div><br class=""></div><div>However, in an application context, I’d usually want application code to *largely* avoid calling such “low-level” methods directly, in favor of wrappers defined in terms of application-level concepts, e.g. some possible examples:</div><div><br class=""></div><div>documentFor(windowState: WindowState) // e.g. state-restoration</div><div><div>documentFor(bookmark: BookmarkData) // e.g. user-favorites menu</div><div>documentFor(user: User) // e.g. a 1:1 user-document thing (consider a test-administration use case)</div><div>documentFor(template: TemplateDescriptor) // e.g. create-new-document from a template of some kind</div><div>documentFor(image: Image) // e.g. create-a-new-document containing `image` and ready for further use</div><div><br class=""></div><div>…and so on and so forth. Note that all of the above are also in conformance with the guidelines—if `documentForURL` is wrong, then `documentForWindowState` is even more wrong!</div><div><br class=""></div><div>So, given that I would prefer application-level code use the "application-level variants", I’m a bit stuck if I want the “application-level” variants to be easy to distinguish (visually) from the “low-level” variant: </div><div><br class=""></div><div>- `documentFor(url: NSURL)` is out of my control, so I can’t unilaterally-demote it to `documentForURL(url: NSURL)` on my end (I can write a wrapper, but can’t hide the base method at this time...)</div><div>- lengthening the “application-level” names goes against the spirit of the guidelines</div><div>- changing the “application-level” names often feels unidiomatic (`restoredDocumentFor(windowState: WindowState)` is ok, but `bookmarkedDocumentFor(bookmark: BookmarkData)` feels awful-and-unnecessary)</div><div><br class=""></div><div>…which wan’t a concern in Objective-C, b/c the increased verbosity kept everything uniform and easily-verifiable:</div><div><br class=""></div><div><div>- `documentForURL:`</div><div>- `documentForWindowState:`</div><div>- `documentForBookmark:`</div><div><div>- `documentForUser:`</div><div class=""><div>- `documentForTemplate:`</div></div><div class=""><div>- `documentForImage:`</div></div><div><br class=""></div><div>…(with the extensions likely having `prefix_` in front to boot!).</div><div><br class=""></div><div>I do think this is going to be a bit awkward in all settings where the guidelines steer us towards having a bunch of identically-named extension methods calling through to “standard-library” functionality; in such settings what used to be adequate type-information (within the standard library context) starts to look like weak type information (in its context-of-use).</div><div><br class=""></div></div></div><div><div>I don’t think the right answer is for, e.g., the Objective-C import to uniformly start using `documentForURL`-type names; that feels like overkill.</div><div><br class=""></div><div>I do think a loosened attitude about when-and-how to include a first-argument label will open up a lot of room to address such concerns; I suspect that the other discussions around when to use identical base names and when to use first argument labels is originating from at-least broadly-similar concerns.</div><div><br class=""></div><div>Perhaps it can be addressed by taking the below:</div><div><br class=""></div><div><blockquote type="cite" class="">Methods can share a base name when they share the same basic meaning but operate on different types, or are in different domains.<br class=""></blockquote><div><br class=""></div>…and tweaking it to include a note that such methods *may* label their first argument when necessary to clarify either:</div><div><br class=""></div>- the method variant (when the methods do the same thing to the point the same base name should be used, but nevertheless are meant for different-enough intents to benefit from an explicit distinction)<br class=""><div>- the interpretation of said argument (hopefully this is rather rare)</div><div><br class=""></div></div></div></div><div>…but at this point I think I’ve said my bit, brought up the delegate-naming issue, and appreciate the time and consideration. The delegate convention seems to need a reboot, anyways, and should seemingly at least wait for the first review of the objective-c import discussion to conclude.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-Dave</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>