[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Elisp / C inconsistency for reading "1."
From: |
Oleh Krehel |
Subject: |
Elisp / C inconsistency for reading "1." |
Date: |
Fri, 14 Mar 2014 13:13:32 +0100 |
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
- Elisp / C inconsistency for reading "1.",
Oleh Krehel <=