digitalmars.D - [OT] Punctuation of "Params:" and "Returns:"
- Andrei Alexandrescu (40/40) Sep 22 2016 Consider e.g.
- H. S. Teoh via Digitalmars-d (9/19) Sep 22 2016 [...]
- Sebastiaan Koppe (2/14) Sep 22 2016 Me too.
- =?UTF-8?Q?Ali_=c3=87ehreli?= (14/20) Sep 22 2016 all up.
- Marco Leise (13/18) Sep 22 2016 You are not the only one scratching his head. I went through
- Jonathan M Davis via Digitalmars-d (6/14) Sep 22 2016 This is what I do (and have done in Phobos). No, it's technically not th...
- bachmeier (5/10) Sep 22 2016 If we're worried about perfect English, we'll be using complete
- Mike Parker (15/23) Sep 22 2016 This one. If nothing were ever to follow the fragment, I would go
- Andrei Alexandrescu (2/10) Sep 23 2016 Thanks for the book reco, looks great. -- Andrei
- Jacob Carlborg (20/37) Sep 23 2016 For the parameters I would skip the trailing period. I view the
- Jack Stouffer (7/8) Sep 23 2016 Why?
- Claude (30/37) Sep 23 2016 I also prefer that version.
Consider e.g. http://dtest.thecybershadow.net/artifact/website-ff971425e306789aa308cfb07cba092cadd11161-d41523308b293d6e0a3d6da971a68db8/web/phobos-prerelease/std_algorithm_sorting. tml#pivotPartition, where we can see the parameters table and the returns subsection. How to formulate these lingustically? If we try do do that with full grammatical sentences, it's awkward: ==== Parameters: r | r is the range subject to partitioning. Returns: Returns something awesome. ==== So attempting to use full sentences with subject and predicate leads to repetition of the parameter name and of the "Returns" word. Which is silly. Next attempt is to use sentence fragments, but format as sentences: ==== Parameters: r | The range subject to partitioning. Returns: Something awesome. ==== This is incorrect because one is not supposed to punctuate sentence fragments as full sentences. Next attempt: ==== Parameters: r | the range subject to partitioning Returns: something awesome ==== So now we don't use a leading capital and punctuation. The challenge here is when the parameter description takes more than one sentence: ==== Parameters: r | the range subject to partitioning. For whatever reason there's a need for a second sentence, so we need to put a period and mess it all up. Returns: something awesome. Sadly, it takes one extra sentence too, making the "something awesome" text awkward. ==== We need to zero in on one good style and use it throughout. Thoughts? Andrei
Sep 22 2016
On Thu, Sep 22, 2016 at 02:26:15PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...]==== Parameters: r | The range subject to partitioning. Returns: Something awesome. ==== This is incorrect because one is not supposed to punctuate sentence fragments as full sentences.[...] I personally prefer this version. I don't think it's incorrect. (Even if it is, does it really matter? The intended meaning is clear, and formatting it as a full sentence looks better.) T -- If you want to solve a problem, you need to address its root cause, not just its symptoms. Otherwise it's like treating cancer with Tylenol...
Sep 22 2016
On Thursday, 22 September 2016 at 18:27:01 UTC, H. S. Teoh wrote:On Thu, Sep 22, 2016 at 02:26:15PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...]Me too.==== Parameters: r | The range subject to partitioning. Returns: Something awesome. ====I personally prefer this version. I don't think it's incorrect. (Even if it is, does it really matter? The intended meaning is clear, and formatting it as a full sentence looks better.)
Sep 22 2016
On 09/22/2016 11:26 AM, Andrei Alexandrescu wrote:So now we don't use a leading capital and punctuation. The challenge here is when the parameter description takes more than one sentence: ==== Parameters: r | the range subject to partitioning. For whatever reason there's a need for a second sentence, so we need to put a period and mess itall up. I agree that only a sentence should have a period. Although I'm not aware of intra-paragraph dividers in typography, how about using a bullet or a dash before the subsequent sentences: ==== Parameters: r | the range subject to partitioning • For whatever reason there's a need for a second sentence, it can follow the divider character. We can have even more sentences. While on topic, how about using different colors for template and function parameters? I leave the choice of colors to people with synesthesia. :) Ali
Sep 22 2016
Am Thu, 22 Sep 2016 14:26:15 -0400 schrieb Andrei Alexandrescu <SeeWebsiteForEmail erdani.org>:Consider e.g. http://dtest.thecybershadow.net/artifact/website-ff971425e306789aa308cfb07cba092cadd11161-d41523308b293d6e0a3d6da971a68db8/web/phobos-prerelease/std_algorithm_sorting. tml#pivotPartition, where we can see the parameters table and the returns subsection. How to formulate these lingustically?You are not the only one scratching his head. I went through the same stages, from full sentence over removing repeated words, to lowercase without punctuation. /Currently/ I'm using: Returns: pointer to the parent object; maybe `null` if this is the root object Anything needing a long explanation then needs to be written in a way that it refers to the description paragraph(s) above in brief. Happy bike-shedding :) -- Marco
Sep 22 2016
On Thursday, September 22, 2016 14:26:15 Andrei Alexandrescu via Digitalmars-d wrote:==== Parameters: r | The range subject to partitioning. Returns: Something awesome. ==== This is incorrect because one is not supposed to punctuate sentence fragments as full sentences.This is what I do (and have done in Phobos). No, it's technically not the best English, but it works quite well IMHO, and almost no one is going to care that it's not perfect English. - Jonathan M Davis
Sep 22 2016
On Thursday, 22 September 2016 at 22:44:13 UTC, Jonathan M Davis wrote:This is what I do (and have done in Phobos). No, it's technically not the best English, but it works quite well IMHO, and almost no one is going to care that it's not perfect English. - Jonathan M DavisIf we're worried about perfect English, we'll be using complete sentences rather than sentence fragments, so the punctuation won't be relevant.
Sep 22 2016
On Thursday, 22 September 2016 at 18:26:15 UTC, Andrei Alexandrescu wrote:==== Parameters: r | The range subject to partitioning. Returns: Something awesome. ==== This is incorrect because one is not supposed to punctuate sentence fragments as full sentences. Next attempt:This one. If nothing were ever to follow the fragment, I would go with no caps and no punctuation. As that's not the case, then this is the one. It's acceptable in English writing to break the rules where it flows and improves readability than to force something awkward out of conformity. On a related note, I recommend anyone who frequently writes (no matter the context -- software docs included) to read Steven Pinker's 'The Sense of Style' [1]. It's practical advice for modern writing that, IMO, does more to destroy Strunk & White (in a respectful manner) than improve upon it. Basically, he dispenses with dogma in favor of practicality. [1] http://stevenpinker.com/publications/sense-style-thinking-persons-guide-writing-21st-century
Sep 22 2016
On 9/23/16 2:17 AM, Mike Parker wrote:On a related note, I recommend anyone who frequently writes (no matter the context -- software docs included) to read Steven Pinker's 'The Sense of Style' [1]. It's practical advice for modern writing that, IMO, does more to destroy Strunk & White (in a respectful manner) than improve upon it. Basically, he dispenses with dogma in favor of practicality. [1] http://stevenpinker.com/publications/sense-style-thinking-persons-guide-writing-21st-centuryThanks for the book reco, looks great. -- Andrei
Sep 23 2016
On 2016-09-22 20:26, Andrei Alexandrescu wrote:==== Parameters: r | the range subject to partitioning Returns: something awesome ==== So now we don't use a leading capital and punctuation. The challenge here is when the parameter description takes more than one sentence:I use this style.==== Parameters: r | the range subject to partitioning. For whatever reason there's a need for a second sentence, so we need to put a period and mess it all up. Returns: something awesome. Sadly, it takes one extra sentence too, making the "something awesome" text awkward. ==== We need to zero in on one good style and use it throughout. Thoughts?For the parameters I would skip the trailing period. I view the parameters as a list and I've learned that the items in a lists (bullet point lists) should not end with a period. I might be completely wrong and it might not apply to English, but that's what I do. Keep in mind as well that all this might also depend on how Ddoc renders the documentation. For example, if Ddoc renders the returns section like this: Returns: some useful value Then it make senses to skip the leading capitalization. But if Ddoc renders the section like this: Return Value: some useful value Then it might look awkward to not use leading capitalization. Same thing with the parameters. It all depends on if the section/parameter is rendered in a way that it makes sense/make it look like the section/parameter is part of the sentence. -- /Jacob Carlborg
Sep 23 2016
On Thursday, 22 September 2016 at 18:26:15 UTC, Andrei Alexandrescu wrote:We need to zero in on one good style and use it throughout.Why? Shouldn't the main focus be intelligibility rather than being grammatically correct? I really don't think there should be a hard and fast rule for something this trivial when there are a lot of function docs that still don't have these sections in them.
Sep 23 2016
On Thursday, 22 September 2016 at 18:26:15 UTC, Andrei Alexandrescu wrote:Parameters: r | The range subject to partitioning. Returns: Something awesome. ==== This is incorrect because one is not supposed to punctuate sentence fragments as full sentences. Next attempt:I also prefer that version. And I think it makes sense even linguistically. Sentences in english could be formalized as: <Subject> <verb> <object> [when/where/why/...]. But sometimes, only fragments of sentences are used, when a fragment is already implied. For instance, for the imperative form, we may write Alice said to Bob: "Do this!". "Do this!" is a perfectly valid english sentence, and the subject is implied: Bob (and not Alice). Expanded, it would give: Alice wants Bob to do this. Or: Alice wants "Bob does this". So, for comments, it is also ok to do the same. i.e. /** * Get a coefficient from the 2D matrix. (subject implied: function getCoef) * * Parameters: * r | Row index. (subject implied: parameter r) * c | Column index. (subject implied: parameter c) * * Returns: * Coefficient fetched at the specified row and column. (subject implied: Return value) */ float getCoef(int r, int c)
Sep 23 2016