all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleh Krehel <oleh.krehel@gmail.com>
To: emacs-devel@gnu.org
Subject: Elisp / C inconsistency for reading "1."
Date: Fri, 14 Mar 2014 13:13:32 +0100	[thread overview]
Message-ID: <CAJ1SQWC8NvC-GyGzb+EgZ2AADzqG0Wc1Z1dcUQcdE=c-eCHoOQ@mail.gmail.com> (raw)

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



             reply	other threads:[~2014-03-14 12:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 12:13 Oleh Krehel [this message]
2014-03-14 14:30 ` Elisp / C inconsistency for reading "1." 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ1SQWC8NvC-GyGzb+EgZ2AADzqG0Wc1Z1dcUQcdE=c-eCHoOQ@mail.gmail.com' \
    --to=oleh.krehel@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.