From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: integer overflow Date: Sat, 06 Mar 2010 20:04:11 +0100 Message-ID: References: <4B8147A9.7030504@gmail.com> <87ljemdzxo.fsf@stupidchicken.com> <4B83682D.5010804@gnu.org> <87vddmpw4s.fsf@stupidchicken.com> <87hbp2fwoi.fsf@gnu.org> <87wrxrr4md.fsf@gnu.org> <3vsk8ecg6a.fsf@fencepost.gnu.org> <873a0euot4.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267959681 12627 80.91.229.12 (7 Mar 2010 11:01:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 7 Mar 2010 11:01:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 07 02:43:09 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1No5WE-0006AG-FY for ged-emacs-devel@m.gmane.org; Sun, 07 Mar 2010 02:43:05 +0100 Original-Received: from localhost ([127.0.0.1]:46383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1No5W2-0001zw-Fh for ged-emacs-devel@m.gmane.org; Sat, 06 Mar 2010 20:42:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nnzw2-0000Rj-MO for emacs-devel@gnu.org; Sat, 06 Mar 2010 14:45:14 -0500 Original-Received: from [140.186.70.92] (port=49434 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nnzw1-0000RQ-JO for emacs-devel@gnu.org; Sat, 06 Mar 2010 14:45:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nnzw1-0005zA-2i for emacs-devel@gnu.org; Sat, 06 Mar 2010 14:45:13 -0500 Original-Received: from dial-183205.pool.broadband44.net ([212.46.183.205]:36755 helo=ix) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nnzw0-0005yy-Rz for emacs-devel@gnu.org; Sat, 06 Mar 2010 14:45:13 -0500 Original-Received: from helmut by ix with local (Exim 4.69) (envelope-from ) id 1NnzIJ-0002a7-Qu; Sat, 06 Mar 2010 20:04:11 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 06 Mar 2010 10:45:12 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Sat, 06 Mar 2010 20:41:37 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:121678 Archived-At: * Stefan Monnier [2010-03-06 16:45+0100] writes: >>>> Can you summarize how it's supposed to work? >>> The change affects the Lisp reader: reading "536870912" or any larger >>> number now gives you a float Lisp object, instead of an integer Lisp >>> object (since there is no way to represent 536870912 or larger as >>> integers). 536870911 and below are still read as integers. >> What's the point of doing that? I would much prefer if read would just >> raise an error. > > There are many cases where it's important to read an integer from some > other program, so it's important to be able to read integers larger the > Elisp's largest fixnum (tho less so for integers larger than the > host system's natural "int"). > Examples are file sizes, process ids, user ids, ... read doesn't seem the right tool for this job; read is for parsing Lisp syntax. Those few programs which produce Lisp syntax should probably just write floats if there is a danger of overflow and precision doesn't matter. For those cases were precision does matter (eg. a 32bit Emacs reading a file produced by a 64bit Emacs) I'd prefer an error instead of automatic coercions. Helmut