all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Simon Leinen <simon.leinen@gmail.com>
To: Stefan <monnier@iro.umontreal.ca>,
	Paul Eggert <eggert@cs.ucla.edu>,
	 Oleh Krehel <oleh.krehel@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: Elisp / C inconsistency for reading "1."
Date: Sat, 15 Mar 2014 19:39:43 +0100	[thread overview]
Message-ID: <CAAO6KgCOzm-W3T_nxNi=wmWS9i-_PTcxLfSk9mFgYn9X+7z+aQ@mail.gmail.com> (raw)
In-Reply-To: <85vbvf8m3j.fsf@iznogoud.viz>

[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

On Sat, Mar 15, 2014 at 5:21 PM, Wolfgang Jenkner <wjenkner@inode.at> wrote:

> But please don't base your opinion on a wrong assumption about Common
> Lisp, see [1],
>
>         Integers can be written as a sequence of digits [...]
>         optionally followed by a decimal point;


Thanks for the reminder!

In case anyone wonders why Common Lisp does it this way: CL has
*READ-BASE*, which allows integers to be parsed and unparsed in bases other
than decimal.  I think this came from Maclisp, one of the more important
Lisp dialects that CL wanted to unify.  Maclisp defaulted to interpreting
digit-sequences as octal(!).

So in Common Lisp, when you want to make sure you're in "decimal" mode,
    (SETQ *READ-BASE* 10.)
makes more sense than just
    (SETQ *READ-BASE* 10)
and reads better than e.g.
    (SETQ *READ-BASE* (+ 1 1 1 1 1 1 1 1 1 1))

Sorry for the digression.  As for how Emacs should interpret numbers with a
trailing dot: If we want to keep Emacs Lisp aligned with Common Lisp, then
we should continue to treat them as decimal integers, and live with the
fact that users coming from other languages may have to learn to type "1.0"
instead of "1." when they want floats.  Personally I don't have a strong
opinion, although I have a slight preference to value CL compatibility
higher than convenience for non-native Lisp speakers in this case.  "1."
just doesn't look real float'y to me.
-- 
Simon.

[-- Attachment #2: Type: text/html, Size: 1965 bytes --]

  parent reply	other threads:[~2014-03-15 18:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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='CAAO6KgCOzm-W3T_nxNi=wmWS9i-_PTcxLfSk9mFgYn9X+7z+aQ@mail.gmail.com' \
    --to=simon.leinen@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=oleh.krehel@gmail.com \
    /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.