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

> > The doc for every Emacs function should say what the return value is.
> 
> Hm. I disagree. Many functions are used just by their side effects,

1. "Many" in absolute terms.  Very few in relative terms.  They are
   exceptions to the rule, not the norm.  This is Lisp, not C.

2. Such exceptional functions should be *explicitly documented* as
   such.  See below.  See the Common Lisp spec and doc, as a good
   model to follow.

> and forcing them to declare a return value and keep it forever
> back-compatible is unreasonable, especially when the return value is
> quite arbitrary. You simply shouldn't rely on them returning anything
> sensible.

100% agreed, wrt those few, exceptional functions, *provided* that this
exceptional do-not-rely-on-return-value behavior is explicitly
documented.  Users get what they deserve, *provided* they have been told
explicitly not to count on the return value.  If we do not tell them
that then they deserve better.  They deserve and should expect a
reasonable return value if we do not advise them otherwise.

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.

FWIW, I was more exact in what I said in bug #15117:

  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: "This function is used only for its side 
  effects; the return value is undefined."  This is Lisp, not C - 
  return values are the norm, not the exception.

NB. "for some *special* (*good*) reason".





  reply	other threads:[~2013-08-17 16:14 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 [this message]
2013-08-17 17:44     ` Juanma Barranquero
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=1e335257-878b-4e7a-88d2-be252422b045@default \
    --to=drew.adams@oracle.com \
    --cc=15116@debbugs.gnu.org \
    --cc=lekktu@gmail.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.