all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: 15116@debbugs.gnu.org
Subject: bug#15116: 24.3.50; doc of `set-match-data'
Date: Sat, 17 Aug 2013 19:44:41 +0200	[thread overview]
Message-ID: <CAAeL0SSNr5yhgGkpHB7W6rfDd1piCA87-NvnciJoc+zzouyOKA@mail.gmail.com> (raw)
In-Reply-To: <1e335257-878b-4e7a-88d2-be252422b045@default>

On Sat, Aug 17, 2013 at 6:14 PM, Drew Adams <drew.adams@oracle.com> wrote:

> The (unwritten) rule should *not* be that if the Emacs doc says nothing
> about a return value then you should assume that it is undefined (you
> cannot rely on it).
>
> The rule should be that the doc for each function either (a) specifies
> the return value or (b) tells you that the return value is undefined
> (do not rely on it) and the function is used only for its side effects.
>
> In sum: the rule should be explicitness in our doc, not just lazy
> omission of such important information.

Sorry, I still disagree. The general rule is always that if nothing is
said, nothing can be assumed (or, alternatively, assume at your own
peril). Many functions *do* declare their return value, but that is
generally because the return value is potentially useful. More power
to them (and us). For the rest, adding a note saying that the return
value is undefined is nice, but in many cases unnecessary and verbose
IMO. And I don't think laziness is involved, BTW.

>   If, for some special (good) reason, code should not rely on the
>   return value of some function then this fact should be stated
>   explicitly in the doc:

I don't see how the coder could fail to notice that there's a good
reason not to use the return value of some specific function, if that
return value is undocumented.

This is not theoretical. Sometimes I've used the return value of a
function without looking at its docstring. When afterwards I've
wondered whether I was doing the right thing, a simple look and the
realization that it wasn't, in fact, documented, was enough to go "oh,
bummer" and fix my code. "The return value of this function is
undefined" would've added nothing of value, except in functions with
very large or complex docstrings. And, in this cases, the docstring
author *can* add the notice; it's not forbidden.

Summarizing: I agree it can be OK to add the notice. I don't agree
there's some kind of obligation to document that it is undefined.

   J





  reply	other threads:[~2013-08-17 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-17 15:26 bug#15116: 24.3.50; doc of `set-match-data' Drew Adams
2013-08-17 15:40 ` Juanma Barranquero
2013-08-17 16:14   ` Drew Adams
2013-08-17 17:44     ` Juanma Barranquero [this message]
2013-08-17 18:37       ` Drew Adams
2013-08-18  2:06         ` Juanma Barranquero
2013-08-17 17:32 ` Glenn Morris
2013-08-17 17:42   ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeL0SSNr5yhgGkpHB7W6rfDd1piCA87-NvnciJoc+zzouyOKA@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=15116@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.