News for hackers. Stuff that matters.
Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by ghanrt on Monday March 22, 2021 @02:15PM (#26544542)
It is. Apart from ++index, this is literally the same as:

  let ch = if index < strlen then str.charAt(index) else 0
Eminently readable and less boring than long if/else chains in Python.
Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by dmos62 on Monday March 22, 2021 @06:19PM (#26548097)
It's not. To be easily human-parsable you want to do one thing at a time. It's that incrementation that you've ommited that messes things up.

On a side note, having gotten used to newer languages, an option type sure is a nice thing.

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by Twirrim on Monday March 22, 2021 @05:36PM (#26547504)
You can write in a very similar way in python too if you want to. I think I'd argue this is cleaner syntax, even.

    >>> foo = 10
    >>> bar = foo if foo > 5 else 0
    >>> bar
    10
    >>> bar = foo if foo < 5 else 0
    >>> bar
    0
Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by jldugger on Tuesday March 23, 2021 @12:40AM (#26551197)
IDK,

"for ch in index:"

reads pretty cleanly to me.