From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.devel Subject: Elisp / C inconsistency for reading "1." Date: Fri, 14 Mar 2014 13:13:32 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1394805214 10934 80.91.229.3 (14 Mar 2014 13:53:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Mar 2014 13:53:34 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 14 14:53:43 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WOSYR-0006x0-7l for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2014 14:53:43 +0100 Original-Received: from localhost ([::1]:44909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOSYQ-0008Cr-T2 for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2014 09:53:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOQzX-0003c8-4t for emacs-devel@gnu.org; Fri, 14 Mar 2014 08:13:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOQzW-0003Hj-4w for emacs-devel@gnu.org; Fri, 14 Mar 2014 08:13:35 -0400 Original-Received: from mail-vc0-x22b.google.com ([2607:f8b0:400c:c03::22b]:58903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOQzW-0003Fc-0I for emacs-devel@gnu.org; Fri, 14 Mar 2014 08:13:34 -0400 Original-Received: by mail-vc0-f171.google.com with SMTP id lg15so2573273vcb.2 for ; Fri, 14 Mar 2014 05:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=1uCxTpo3RgAcGoMAq0UctOyOZSLDGgOiIinQEv2p2rs=; b=iqAgh94BrOzprZP2+6x5tbeebxvePQxZGiKslmXDlG9iW6pMB9vCL23OnX1qTqgsYF XhhEMHTZUCVVBdh2VqKCL+lJ0i9FgbRynbwTsPOQXdTWgkswukRJrifLYHQ0O4wHz2BB cIysxe62HC1H5prcGJfbLU81gXcTid1zWn57hC2x5LXQXWj6u+1ZOjtJKTs8UYFAqeNc qFe3PV9iZQLNUjERsAf34EQlq4mZOI14QyIJvq2QiAifeMhHnBpCwU5zN47EBO1mpcb6 +11c+7t5EI4y8EEQUWLk3FDQvbGNc/4aIe4lirLh2oiXvd/v9FxrbyPtFKLdOauuBkFh PnOA== X-Received: by 10.52.135.65 with SMTP id pq1mr5109990vdb.13.1394799212976; Fri, 14 Mar 2014 05:13:32 -0700 (PDT) Original-Received: by 10.58.119.230 with HTTP; Fri, 14 Mar 2014 05:13:32 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c03::22b X-Mailman-Approved-At: Fri, 14 Mar 2014 09:53:40 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:170357 Archived-At: 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