[swift-evolution] Returning nothing

Daniel Duan daniel at duan.org
Fri Jul 22 19:26:15 CDT 2016


On Jul 22, 2016, at 2:38 PM, James Dempsey via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I think there might be some confusion since the Swift API Design Guidelines session at WWDC 2016 mentions:
> “One of the principles of this particular API Design Guidelines is that we really want the use sites to read grammatically.”
> and continues with a number of examples.
> 
> and the current Swift API Design Guidelines state:
> “Prefer method and function names that make use sites form grammatical English phrases.”.
> 
> So there has been strong guidance to prefer Swift APIs that read like English grammar at the call site.
> 
> But I don’t think there has been any guidance to make API declarations read like English grammar.
> 
> But Chris just wrote:
>> I said that Swift was not designed to mock English grammar
> 
> 

We shouldn’t conflate language design and API design. It’s true that a programming language’s builtin keywords make up part of all APIs at the end of the day. But the language has a different set of priorities. Language designer (most of the time) have more syntax to worry about than API designers. The importance of term of art, succinctness, read-like-natural-language-ness…have different weights compared to APIs (not saying one way or another). 

> My understanding is that:
> 
> - It is preferable for method and function names to form grammatical English phrases at the call site — but not absolutely necessary if something that breaks this guideline provides more clarity at the call site.
> 
> - There is no guidance that API declarations are expected to read grammatically
> 

You said it in the first point: clarity at point of use is preferred, not necessarily at the point of declaration.

> Is my understanding correct?
> 
> Thanks,
> 
> James
> 
> ———————
> James Dempsey
> dempsey at mac.com
> 
> 
> 
>> On Jul 21, 2016, at 3:29 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> On Jul 21, 2016, at 3:02 PM, Daniel Steinberg via swift-evolution <swift-evolution at swift.org> wrote:
>>> Chris’ note addressed my misconception that a goal of Swift was that it could be a good first or learning language.
>> 
>> Please clarify this.  I said that Swift was not designed to mock English grammar.  It is absolutely intended to be a good teaching language, and I never said otherwise.
>> 
>> -Chris
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> 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