GNU bug report logs - #6891
`string-to-number' doesn't recognize `#'' read syntax

Previous Next

Package: emacs;

Reported by: MON KEY <monkey <at> sandpframing.com>

Date: Sat, 21 Aug 2010 00:01:01 UTC

Severity: wishlist

Tags: wontfix

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6891 in the body.
You can then email your comments to 6891 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6891; Package emacs. (Sat, 21 Aug 2010 00:01:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to MON KEY <monkey <at> sandpframing.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 21 Aug 2010 00:01:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: MON KEY <monkey <at> sandpframing.com>
To: bug-gnu-emacs <at> gnu.org
Subject: `string-to-number' doesn't recognize `#'' read syntax
Date: Fri, 20 Aug 2010 20:01:06 -0400
`string-to-number' takes an optional arg BASE but doesn't recognize lisp `#'
read syntax for binary, octal, hex, and radix, e.g.  `#o', `#b', `#x', and
`#<RADIX>r'. It should, these _are_ the respective read syntax for BASE.
For good measure it should also recognize the string output from
`format's `#' flag for octal and hex e.g `0x' for hex and `0' for octal.

The proposed behaviour should not pose a lisp dialect compatiblility problem as
Emacs lisp does not attempt to follow the Common Lisp spec, does not maintain a
duplicate for CL's `parse-integer' procedure and does not take a bounding START
END arg, but _does_ parse floats so it shouldn't be restricted by that specs
constraints w/re the `#' radix read syntax e.g:

,----
| `parse-integer' does not recognize the syntactic radix-specifier
| prefixes `#O', `#B', `#X', and `#nR', nor does it recognize a trailing
| decimal point.
`----

Besides, `string-to-number' already has a BASE argument, the C code already
strips whitespace, discards "junk", and exhibits a willingness to interpolate
sign in sometimes odd ways, so a little more DWIM can't hurt.

Current `string-to-number' DWIMness:
string-to-number "   -3777777777" 8) ;=> 536870911
(string-to-number "   -3777777777.007" 8) ;=> 536870911
(string-to-number "   -3777777777mmm#" 8) ;=> 536870911
(string-to-number "+   -3777777777mmm#" 8) ;=> 0

Following illustrates the additioanl DWIMing desired:

#o
(string-to-number "#o3777777777" 8) ;=> 536870911

#b
(string-to-number "#b11111111111111111111111111111" 2) ;=> 536870911

#x
(string-to-number "#x1fffffff" 16) ;=> 536870911

#<RDX>r
(string-to-number "#12r12B969227" 12) ;=> 536870911

0x
(string-to-number "0x1fffffff" 16) ;=> 536870911

0
(string-to-number "03777777777" 8) ;=> 536870911


--
/s_P\




Severity set to 'wishlist' from 'normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sun, 22 Aug 2010 21:20:03 GMT) Full text and rfc822 format available.

Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 04 Mar 2016 15:35:26 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6891; Package emacs. (Wed, 26 Jun 2019 11:38:01 GMT) Full text and rfc822 format available.

Message #12 received at 6891 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: 6891 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#6891: `string-to-number' doesn't recognize `#'' read syntax
Date: Wed, 26 Jun 2019 13:37:32 +0200
This bug was tagged as wontfix three years ago.

Is it desirable to close it too?

Thanks,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6891; Package emacs. (Wed, 26 Jun 2019 11:45:01 GMT) Full text and rfc822 format available.

Message #15 received at 6891 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 6891 <at> debbugs.gnu.org
Subject: Re: bug#6891: `string-to-number' doesn't recognize `#'' read syntax
Date: Wed, 26 Jun 2019 13:44:41 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> This bug was tagged as wontfix three years ago.
>
> Is it desirable to close it too?

I think so.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Wed, 26 Jun 2019 15:17:04 GMT) Full text and rfc822 format available.

Notification sent to MON KEY <monkey <at> sandpframing.com>:
bug acknowledged by developer. (Wed, 26 Jun 2019 15:17:04 GMT) Full text and rfc822 format available.

Message #20 received at 6891-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: stefan <at> marxist.se, 6891-done <at> debbugs.gnu.org
Subject: Re: bug#6891: `string-to-number' doesn't recognize `#'' read syntax
Date: Wed, 26 Jun 2019 18:15:27 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 26 Jun 2019 13:44:41 +0200
> Cc: 6891 <at> debbugs.gnu.org
> 
> Stefan Kangas <stefan <at> marxist.se> writes:
> 
> > This bug was tagged as wontfix three years ago.
> >
> > Is it desirable to close it too?
> 
> I think so.

Agreed and done.

Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 25 Jul 2019 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 276 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.