emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: constant `e'


From: Alan Mackenzie
Subject: Re: constant `e'
Date: 10 Feb 2007 10:02:38 +0100
Date: Sat, 10 Feb 2007 10:17:00 +0000
User-agent: Mutt/1.5.9i

Hi, Drew!

On Thu, Feb 08, 2007 at 11:37:36PM -0800, Drew Adams wrote:
> A minor whine - ignore if you don't agree.

No such luck!

> Single-character global variables are generally not such a great idea.
> In particular, they can easily occur as typographical errors and not be
> detected for a while.

Has this happened to you?

> The variable `e', defined in `float-sup.el', has been around for a long
> time, but I wonder if it wouldn't be better to give it a different name
> in Emacs, because of the possibility of `e' occurring as a typo.

e has been around for several hundred years.  It is known by that name
universally in European language cultures.  Anybody who understands its
concept instantly recognises its one-letter name, just as any hacker
recognises the name C.  Has e ever been known to mathematicians by any
other name?  So no, in my humble opinion, it would not be a good idea to
give it a new name.

> `t' is similar, of course, but `t' as a typo is less surprising for
> anyone at all used to Lisp. `e' as a numerical constant is not used in
> most Emacs-Lisp code, so it is more likely that someone might be
> surprised by the effect of an `e' typo (once discovered).

If e were to be renamed, how would anybody find out it exists?  Who would
remember the new name?

> The position of `e' on many keyboards also makes it easy to hit when
> you mean to hit a numeral key such as `3', and, unlike `t', the type of
> `e' is numeric, so the value mismatch won't always lead to a type
> mismatch that might make the error more apparent.

Come on, Drew - post the error you made or came across, please!

> There are many other one-letter physical and mathematical constants.
> Fortunately, their names are not used as the names of Emacs constants
> and variables. `e' seems to be the exception. Even a two-letter name,
> such as `pi', is much, much less error prone than a one-letter name.

Despite being a maths graduate, I can't think of any other such constants
with anything like the universality of e and pi.

[ .... ]

> The best joke is not that self-referencing comment, but the fun someone
> would have trying to find all occurrences of variable `e' in the
> existing code, ....

Something like
"^\([^e;\]\|\\.\|[a-zA-Z_-]e\|e[a-zA-Z_-]\)*e\([^a-zA-Z_-]\|$\)"
(fully untested), would find them easily enough.

> .... to rename them (and debugging missed or inappropriate renamings).
> Undefining it and seeing what happens would be one approach...
> Obviously not something to attempt before the release, in any case. ;-)

I don't think there would be that many to find.

-- 
Alan Mackenzie (Ittersbach, Germany)




reply via email to

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