all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Koning <dk@danielkoning.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 6130@debbugs.gnu.org, busk@lysator.liu.se
Subject: bug#6130: 23.1; artist-mode spray-can malfunction
Date: Fri, 23 Jan 2015 15:52:54 -0600	[thread overview]
Message-ID: <m2wq4dp3k9.fsf@danielkoning.com> (raw)
In-Reply-To: <83ppa5rxxo.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 23 Jan 2015 23:26:11 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

> We do that all the time.  For example:
>
>   (display-graphic-p &optional DISPLAY)
>
>   Return non-nil if DISPLAY is a graphic display.
>   [...]
>   DISPLAY can be a display name, a frame, or nil (meaning the selected
>   frame's display).

From a user perspective, there is a crucial distinction between these
two examples of ambiguous naming.

When an argument is called DISPLAY even though it can be other things
besides a display, the function still works in every case that its name
and its arguments' names suggest that it should work.

But when the return value is called WINDOW when it might not be one,
then it becomes a source of potential error merely to rely on the
function to behave as its name suggests. Sure, you can write
documentation to warn users about the pitfall, but misleading naming
conventions are one of the factors that cause people to write mistaken
documentation. (Cf. the documentation of `posn-window' until a few days
ago!)

> In polymorphic interfaces, the alternative is to say
> DISPLAY-OR-FRAME-OR-... which is too tedious.

If that's the main problem with assigning accurate names in polymorphic
contexts -- that the names end up too long when you include every
possible type -- how about defining a supertype which includes (in this
case) both windows and frames?  That may seem cumbersome, but realize
that this is effectively what is already happening, insofar as "window"
is being coerced into serving as metonymy for the entire class of
mouse-position containers.

Daniel






  reply	other threads:[~2015-01-23 21:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07 12:17 bug#6130: 23.1; artist-mode spray-can malfunction busk
2015-01-17  5:25 ` Daniel Koning
2015-01-17 13:56   ` martin rudalics
2015-01-18  5:47     ` Daniel Koning
2015-01-18  9:57       ` martin rudalics
2015-01-21  0:26         ` Daniel Koning
2015-01-21  8:22           ` martin rudalics
2015-01-21 15:22           ` Stefan Monnier
2015-01-21 16:54             ` martin rudalics
2015-01-22 17:02               ` Stefan Monnier
2015-01-22 18:23                 ` martin rudalics
2015-01-22 23:08                   ` Stefan Monnier
2015-01-23  8:26                     ` martin rudalics
2015-01-23  9:43                       ` Eli Zaretskii
2015-01-23 16:54                         ` martin rudalics
2015-01-23 21:05                           ` Stefan Monnier
2015-01-23 21:26                             ` Eli Zaretskii
2015-01-23 21:52                               ` Daniel Koning [this message]
2015-01-24  8:12                                 ` Eli Zaretskii
2015-01-24  9:08                                   ` martin rudalics
2015-01-24  9:49                                     ` Eli Zaretskii
2016-04-06  9:17 ` Johan Busk Eriksson

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=m2wq4dp3k9.fsf@danielkoning.com \
    --to=dk@danielkoning.com \
    --cc=6130@debbugs.gnu.org \
    --cc=busk@lysator.liu.se \
    --cc=eliz@gnu.org \
    /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.