emacs-devel
[Top][All Lists]
Advanced

[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: Fri, 02 Nov 2007 09:18:52 +0900

Richard Stallman <address@hidden> writes:
>     > 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.
>
> It is not weird to name a function based on the job you do with it.

It's not very helpful for elisp hackers, however -- to understand what's
going on, they must go and read the source code to the function in
question -- whereas a better name _does_ help them.

If you see:

   (if (i-should-jump-p) (jump))

That really tells you nothing about the reasons for jumping (you need to
read i-should-jump-p to find out), whereas:

   (if (im-really-depressed-p) (jump))

tells you why in a glance; to find out all the gory details you need to
read more, but until you do that, you still have a good general idea.

The former style can be desirable if the details of should-jump-p in
fact are very complicated (not summarizable by a single phrase) or might
change often though user-customization or whatever.  Still, one has to
weigh flexibility against clarity in deciding which style to use.

> The other good names cause practical problems which have already been
> explained.

Well then why not pick _another_ good name which is still helpful to the
code reader?  David Kastrup suggested `region-selected-p', which seems
intuitive and helpful in the same way that region-active-p is.

-Miles

-- 
The automobile has not merely taken over the street, it has dissolved the
living tissue of the city.  Its appetite for space is absolutely insatiable;
moving and parked, it devours urban land, leaving the buildings as mere islands
of habitable space in a sea of dangerous and ugly traffic.
[James Marston Fitch, New York Times, 1 May 1960]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]