From: Drew Adams <drew.adams@oracle.com>
To: John Wiegley <jwiegley@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: tino.calancha@gmail.com, emacs-devel@gnu.org
Subject: RE: Ibuffer: w and B default to buffer at current line
Date: Sat, 17 Sep 2016 16:26:34 -0700 (PDT) [thread overview]
Message-ID: <4ec39f76-8397-42d4-9422-b75b379dcff5@default> (raw)
In-Reply-To: <m2k2eamcoy.fsf@newartisans.com>
> Let me give a hypothetical example: Assume for the sake of argument that
> `count-lines' did not report characters as well, and that someone wished
> to extend the `count-lines' command so that, given a prefix arg, it would
> count characters instead of lines.
>
> What I think should happen in this case is that a new command be created:
> count-items-in-region, which by default counts lines, but with a prefix
> argument counts characters. This leaves that command open to many new
> behaviors in future, while `count-lines' keeps doing just what it says:
> count lines.
>
> What I would object to is adding a new argument to `count-lines', called
> `characters-p', that changes the behavior of count-lines to now count
> characters instead (again, remember this is hypothetical, I know that
> today's `count-lines' already counts characters as well).
Seems like you're confusing a few things.
Is your point about the evolution of an existing function? You
don't want to affect the longtime behavior of an existing function?
Or is it about having a single function (`count-items-in-region'),
from the outset, that can count different things depending on the
presence/value of an optional argument CHARACTERS-P or ITEM-TYPE?
Is it the multiple behaviors that bother you, or the fact that
some existing function is being changed/affected?
> I believe -- very strongly -- that each function should do
> one thing and one thing well,
Define "one thing". Does `mapc' do one thing: map a function
over a list; or does it do any number of things, depending on
its function argument (and its list argument, for that matter).
Is your argument limited to behavior from &optional arguments,
or does it apply also to required args too (e.g. the FUNCTION
arg of `mapc'). Does it make a difference in your understanding
of "do one thing" whether `count-items-in-region' takes a
required CHARACTERS-P or ITEM-TYPE arg or that arg is optional?
> and this one thing should be documented well. I don't like
> magical functions with lots of alternative behaviors,
What constitutes "magical", for you? How many alternative
behaviors is "lots", for you?
Yes, it would annoy me too if I had to try to answer such
questions. ;-) But that's the cost of such generalizing, I
think. Better to discuss such things in specific, concrete
cases. That keeps arguments a bit more grounded.
next prev parent reply other threads:[~2016-09-17 23:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-14 5:35 Ibuffer: w and B default to buffer at current line Tino Calancha
2016-09-14 6:41 ` John Wiegley
2016-09-14 7:21 ` Tino Calancha
2016-09-14 14:08 ` Drew Adams
2016-09-15 22:05 ` John Wiegley
2016-09-16 6:40 ` Eli Zaretskii
[not found] ` <<83intw5our.fsf@gnu.org>
2016-09-16 14:53 ` Drew Adams
2016-09-17 16:30 ` John Wiegley
2016-09-17 17:21 ` Eli Zaretskii
2016-09-17 21:35 ` John Wiegley
2016-09-17 23:26 ` Drew Adams [this message]
2016-09-17 23:51 ` John Wiegley
2016-09-18 1:45 ` Drew Adams
2016-09-18 2:18 ` John Wiegley
2016-09-18 14:26 ` Eli Zaretskii
2016-09-18 19:35 ` John Wiegley
[not found] ` <<83zin630i9.fsf@gnu.org>
2016-09-17 18:47 ` Drew Adams
2016-09-17 19:25 ` Eli Zaretskii
[not found] ` <<83vaxuib1p.fsf@gnu.org>
2016-09-17 19:33 ` Drew Adams
2016-09-18 14:29 ` Eli Zaretskii
[not found] ` <<d33a60f5-b8b6-4637-b3e6-ea1b09d98f85@default>
[not found] ` <<83poo1i8nf.fsf@gnu.org>
2016-09-18 17:55 ` naming functions [was: Ibuffer: w and B default to buffer at current line] Drew Adams
2016-09-18 19:23 ` John Wiegley
2016-09-18 23:24 ` Drew Adams
2016-09-19 16:35 ` Eli Zaretskii
2016-09-17 18:22 ` Ibuffer: w and B default to buffer at current line Tino Calancha
2016-09-26 12:08 ` Tino Calancha
2016-10-03 12:28 ` Tino Calancha
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ec39f76-8397-42d4-9422-b75b379dcff5@default \
--to=drew.adams@oracle.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jwiegley@gmail.com \
--cc=tino.calancha@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).