[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: region-active-p
From: |
Miles Bader |
Subject: |
Re: region-active-p |
Date: |
Thu, 01 Nov 2007 11:33:53 +0900 |
Richard Stallman <address@hidden> writes:
> > That name seems ok to me. But I think that `region-overrides-p'
> > hits it more accurately.
>
> Overrides what?
>
> Overrides the command's usual behavior.
Perhaps that's how it's usually used, but to name the predicate based on
that seems sort of weird.
If I see code like:
(if (region-active-p)
...do-this...
...do-that...)
It seems fairly clear to me what's going on (I'm assuming that people
can intuitively grasp the idea of an active region -- given the
commonness of this concept, and the suggestivenss of the term, I think
they can).
But this:
(if (region-overrides-p)
...do-this...
...do-that...)
(1) Obscures the fact that the _reason_ for overriding the is that the
region is active. It sounds "arbitrary".
In fact, upon first seeing it, it sounds like maybe there might be a
"region-override" flag somewhere which controls the behavior, or
that the rules were too complex to find a good intuitive name, and
one must examine `region-override-p' to see what the actual rules
are (I don't think this is true -- I think the _concept_ is pretty
concise). This makes the code harder to understand.
(2) It requires the concept of "usual" behavior to be understood,
whereas a name phrased in terms. Perhaps in many cases that's OK,
but it seems like an unnecessary bit of extra information one is
required to know.
One can imagine a command where the "usual" case the active-region
case, but which also has a useful non-active behavior. For a
command like this, the name "overrides" is awkward.
Anyway, what I'm trying to say is that a name like `region-override-p'
makes code harder to understand.
-Miles
--
"Whatever you do will be insignificant, but it is very important that
you do it." Mahatma Gandhi
- Re: region-active-p, (continued)
- Re: region-active-p, Miles Bader, 2007/10/30
- Re: region-active-p, David Kastrup, 2007/10/31
- Re: region-active-p, Miles Bader, 2007/10/31
- Re: region-active-p, Richard Stallman, 2007/10/31
- Re: region-active-p, Richard Stallman, 2007/10/31
- Re: region-active-p, Miles Bader, 2007/10/31
- Re: region-active-p, Richard Stallman, 2007/10/31
- Re: region-active-p,
Miles Bader <=
- Re: region-active-p, Stefan Monnier, 2007/10/31
- Re: region-active-p, Andreas Röhler, 2007/10/29
- Re: region-active-p, Andreas Röhler, 2007/10/22
- Re: region-active-p, Stephen J. Turnbull, 2007/10/21
- Re: region-active-p, Reiner Steib, 2007/10/21