unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Elisp / C inconsistency for reading "1."
@ 2014-03-14 12:13 Oleh Krehel
  2014-03-14 14:30 ` Paul Eggert
  0 siblings, 1 reply; 7+ messages in thread
From: Oleh Krehel @ 2014-03-14 12:13 UTC (permalink / raw)
  To: emacs-devel

Hi all,

I understand that it's documented in the manual that "1." is an
integer and not a float, but this feels very wrong coming from a C
background.

And a nuisance when I want to quickly compute a percentage in
*scratch*:

    (/ 123. 338)
    ;; => 0

Then I see the error, get annoyed and change to "123.0".
This happens a lot.

Is there any chance for this to be changed?

I did rgrep for "[0-9]\.[^0-9a-zA-Z]" across the emacs/lisp directory
and got 2250 hits.  Filtering that by code-only gives 38 hits, more
then half in vc-annotate.el.  Out of the ELPA/MELPA packages that I
use, the only hits were in zenburn-theme.el.

So it seems to me that this is an easy change to make: since most
Elisp code almost never uses the trailing decimal point in integers
anyway, make the changes to the 38 hits I mentioned above (just remove
the dot) and enforce this style with a compile-time warning/error. At
the same time change the reader to interpret "1." as a float thus
increasing the convenience of an interactive eval.

regards,
Oleh



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

end of thread, other threads:[~2014-03-16  1:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14 12:13 Elisp / C inconsistency for reading "1." Oleh Krehel
2014-03-14 14:30 ` Paul Eggert
2014-03-14 16:46   ` Stefan
2014-03-15 16:21     ` Wolfgang Jenkner
2014-03-15 16:43       ` David Kastrup
2014-03-15 18:39       ` Simon Leinen
2014-03-16  1:31       ` Paul Eggert

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).