all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* e and pi
@ 2010-09-16 13:25 Stefan Monnier
  2010-09-16 13:44 ` Deniz Dogan
                   ` (5 more replies)
  0 siblings, 6 replies; 61+ messages in thread
From: Stefan Monnier @ 2010-09-16 13:25 UTC (permalink / raw)
  To: emacs-devel

As you may have noticed, I have added a new warning to the byte-compiler
for defvars of variables that don't have a prefix.  This is in
preparation for the introduction of lexical scoping: in order not to
have to rewrite all the code, the lexbind branch uses `let' both for
dynamically-scoped let-bindings and for lexically-scoped let-bindings;
where the distinction is based on whether or not a variable has
been defvar'd.  This is the same system as used in Common-Lisp and it
works well in practice, but it requires a bit of care, because every
defvar has a global effect: it declares that this variable will use
dynamic-scoping wherever it gets let-bound.  So if a file uses `len' as
a lexically-scoped variable and another file does a (defvar len), we get
a conflict that results in the first file being evaluated with
a different semantic than expected by the author.

So, the end result is that (defvar <prefix>-<foo>) is OK because the
"<prefix>-" ensures you only mess with your own variable, but (defvar
<foo>) is not OK because you may interfere with some other package.

Now, we have a lot of offending (defvar <foo>) in Emacs currently, so we
will want to fix them, and to get things started, we want to fix the two
predefined float constants `e' and `pi'.

In their case, the solution is to rename them to `float-e' and
`float-pi', but this introduces a backward incompatibility.
I figure we could define-obsolete-variable-alias (which leaves the
problem of `e' and `pi' being dynamically scoped, but hopefully only
for a few versions until we remove the obsolete name), but this means
that every code that does (let ((e <foo>)) ...) would now get a stupid
warning about using an obsolete variable `e'.

So I intend to do the following:
- in Emacs-23.3, define `e', `float-e', `pi', and `float-pi' and declare
  `e' and `pi' obsolete, but without a make-obsolete-variable
  (i.e. only in NEWS and in docstrings).
- in Emacs-24 keep float-e and float-pi but get rid of `e' and `pi'.

Can anyone think of a better solution?


        Stefan



^ permalink raw reply	[flat|nested] 61+ messages in thread
* Re: e and pi
@ 2010-09-17  4:20 MON KEY
  0 siblings, 0 replies; 61+ messages in thread
From: MON KEY @ 2010-09-17  4:20 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

> This is in preparation for the introduction of lexical scoping:

Wow! Thank you.

--
/s_P\



^ permalink raw reply	[flat|nested] 61+ messages in thread
* re: e and pi
@ 2010-09-18  5:58 MON KEY
  2010-09-18 14:50 ` Stefan Monnier
  2010-09-18 16:07 ` David De La Harpe Golden
  0 siblings, 2 replies; 61+ messages in thread
From: MON KEY @ 2010-09-18  5:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

> Not a problem: they do use a prefix, so they don't affect other packages
> (except those using the same prefix, of course).
> OTOH, the regexp I use currently will incorrectly complain about
> "foo/bar" as lacking a prefix.  Will fix it soon,

What about adding `%' and `+' as prefix/suffix to your regexp?

Likewise, could the CL semi-convention of naming "vars with *stars*" e.g.:

(defvar *my-special-frobomatic* {...} )

and constants with + (no equally nice mnemonic here):

(defconst +my-privileged-froboid+ {...} )

be of use to help (textually not syntactically) keep track of variable scoping?

Obv. where a non-existing convention in existing code isn't these won't
help (not without changing _a lot_ of symbol names).

However, maybe as part of the lexbind integration something as above
should be encouraged
in addition to "the prefix namespace".

My impression is that the CL convention for `+' and `*' wrappers is an
idiom born
of lexical/dynamic scoping tensions.

--
/s_P\



^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2010-09-19 19:13 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-16 13:25 e and pi Stefan Monnier
2010-09-16 13:44 ` Deniz Dogan
2010-09-16 15:37   ` Stefan Monnier
2010-09-16 13:47 ` Leo
2010-09-16 15:39   ` Stefan Monnier
2010-09-16 14:27 ` Helmut Eller
2010-09-16 15:44   ` Stefan Monnier
2010-09-16 18:52     ` Helmut Eller
2010-09-16 14:44 ` Jason Rumney
2010-09-16 22:54 ` Chong Yidong
2010-09-17  0:04   ` Deniz Dogan
2010-09-17  0:14   ` Wojciech Meyer
2010-09-17  7:00   ` David Kastrup
2010-09-17  8:09   ` Simon Leinen
2010-09-17  8:15     ` David Kastrup
2010-09-17  9:06       ` Stephen J. Turnbull
2010-09-17  9:21         ` David Kastrup
2010-09-17  9:47   ` Helmut Eller
2010-09-17 15:11   ` Stefan Monnier
2010-09-17 15:22     ` Lars Magne Ingebrigtsen
2010-09-17 15:56       ` Helmut Eller
2010-09-17 22:13         ` Stefan Monnier
2010-09-17 15:44     ` Wojciech Meyer
2010-09-17 15:50     ` Chong Yidong
2010-09-17 16:06       ` Wojciech Meyer
2010-09-17 16:18       ` Helmut Eller
2010-09-17 16:45         ` Glenn Morris
2010-09-17 17:14           ` Glenn Morris
2010-09-18 10:01         ` Eli Zaretskii
2010-09-18 10:21           ` Helmut Eller
2010-09-18 11:07             ` Eli Zaretskii
2010-09-18 11:26               ` Helmut Eller
2010-09-18 10:50           ` David Kastrup
2010-09-18 11:09             ` Eli Zaretskii
2010-09-18 14:27               ` Stephen J. Turnbull
2010-09-18 14:32               ` Andreas Schwab
2010-09-18 15:11           ` Drew Adams
2010-09-17 22:17       ` Stefan Monnier
2010-09-18  1:10         ` Chong Yidong
2010-09-18  8:30           ` Stefan Monnier
2010-09-18 19:10             ` Chong Yidong
2010-09-18 21:37               ` Uday S Reddy
2010-09-19  0:57                 ` Drew Adams
2010-09-18 13:43           ` Juanma Barranquero
2010-09-18 14:53             ` Stefan Monnier
2010-09-18 15:01               ` Lars Magne Ingebrigtsen
2010-09-18 16:00                 ` Stefan Monnier
2010-09-19 10:07               ` Juanma Barranquero
2010-09-17 16:14     ` Drew Adams
2010-09-18 15:12       ` tomas
2010-09-18 17:52         ` David Kastrup
2010-09-19 19:13           ` tomas
2010-09-17 23:35     ` Uday S Reddy
2010-09-17 16:55 ` Sam Steingold
2010-09-17 22:16   ` Stefan Monnier
2010-09-17 22:55     ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2010-09-17  4:20 MON KEY
2010-09-18  5:58 MON KEY
2010-09-18 14:50 ` Stefan Monnier
2010-09-19  2:03   ` MON KEY
2010-09-18 16:07 ` David De La Harpe Golden

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.