Bug 16209 – std.string.isNumeric can work with forward ranges

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-06-27T19:43:00Z
Last change time
2024-12-01T16:27:21Z
Keywords
trivial
Assigned to
No Owner
Creator
Jack Stouffer
Moved to GitHub: phobos#9688 →

Comments

Comment #0 by jack — 2016-06-27T19:43:00Z
isNumeric can be modified to work with forward ranges, not just random access ranges.
Comment #1 by code — 2016-07-05T20:58:28Z
This PR added support for random access ranges. https://github.com/dlang/phobos/pull/4322
Comment #2 by lucia.mcojocaru — 2016-12-23T10:34:44Z
Should this issue be marked as resolved?
Comment #3 by jack — 2016-12-23T12:02:29Z
(In reply to Lucia Cojocaru from comment #2) > Should this issue be marked as resolved? No because isNumeric doesn't yet work with forward ranges.
Comment #4 by andrei — 2016-12-23T21:16:36Z
I think we should just undocument `isNumeric` and cease enhancing it. It's a terrible function. A simple way to figure out whether something is numeric is simply parse it as a number - the work done is similar and you get the number too.
Comment #5 by jack — 2016-12-23T21:30:00Z
(In reply to Andrei Alexandrescu from comment #4) > I think we should just undocument `isNumeric` and cease enhancing it. It's a > terrible function. A simple way to figure out whether something is numeric > is simply parse it as a number - the work done is similar and you get the > number too. 1. someone would first need to make sure that every input on isNumeric works with parse 2. and if so we could just make isNumeric forward to parse That way you don't have to go through the deprecation cycle. I doubt that parse can handle all of the esoteric inputs that isNumeric can handle right now.
Comment #6 by andrei — 2016-12-23T21:33:49Z
(In reply to Jack Stouffer from comment #5) > I doubt that parse can handle all of the esoteric inputs that isNumeric can > handle right now. That's part of the problem. There's very little use of a function that tells you something is numeric, that is not complemented by a function that tells you what the actual number is. This function is inspired from scripting languages that need it for logic such as "if it looks like a number, consider it a number". Has no place in D.
Comment #7 by robert.schadek — 2024-12-01T16:27:21Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9688 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB