emacs-devel
[Top][All Lists]
Advanced

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

RE: e and pi


From: Drew Adams
Subject: RE: e and pi
Date: Fri, 17 Sep 2010 09:14:57 -0700

> because "e" happens to be a predefined global variable with
> dynamic-scoping semantics.  Now for people who use such magic 
> numerical constants often (e.g. in the context of Calc), this
> may seem like an obvious no-no, but for a poor theoretician
> like me who uses "e" days-in-days-out to mean "expression",
> not being able to reliably use "e" as a free variable of a
> closure is a real trap.
> 
> BTW, the worst of the two is `e' and AFAIK it only has a single use in
> Emacs, which is as the initial value of the register "e" in
> calculator.el.
> 
> At least `pi' is used a few more times, and it is not let-bound
> anywhere, so we could decide to make `pi' lexically-scoped 
> and it would apparently work OK, but `e' OTOH is let-bound at
> many places, so it's not at all obvious that making it
> lexically-scoped wouldn't introduce subtle bugs.  Of course,
> this idea of making `pi' and `e' lexically scoped itself depends
> on how one would force lexical-scoping for a few special vars in
> files compiled with dynamic-scoping; something which the
> current lexbind doesn't support right now.

I'll offer my view only once here - and no flames please.

It is _ridiculous_ to ever have given such global vars (constants) these names
in the first place.  I said it long ago and repeat it now that everyone is
trying to jump through fancy hoops to deal with this.

It is sufficient to define global constants with long, clear names, and let any
code that really wants to use short names bind vars locally to the constants.

Just cut the cord and deprecate the old names.  Don't create aliases to provide
compatibility in this case - just bite the bullet (and yes, force 3rd-party code
to do the same).  It's too bad, but this was a horrible design decision made
long ago, and it should just be dealt with summarily.

`float-e' is a longer name, but it is silly - this is not about whether the
value is a  float.  The name should say what the constant means/is - `math-e' or
whatever.  Even a longer name than that is good - it helps avoid conflicts.  The
name can also proclaim that the var is a constant: `math-constant-e' or
whatever.





reply via email to

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