On 08/14/2014 01:30 PM, Alan Bateman wrote:
On 14/08/2014 10:32, Claes Redestad wrote:
:

Any particular place where you think readability becomes a problem? I've grown fond of the
parseInt(s, radix, offset) form myself, but I'm biased. ;-)
It's somewhat subjective but when a method has a sequence of parameters that are the same type (int in this case) then reading the code requires a bit of extra effort to match up the parameters.

Looking at this again then I just wonder if the radix should be last parameter rather than having it appear before the range. I think it would be clearer if the range were to follow the CharSequence rather than having the radix appear in the middle. I didn't have cycles to follow the recent discussion/review on core-libs-dev when these methods were added. Did the ordering come up?

Noone brought it up, as far as I can recall. Since parseInt(String, int radix) already existed, I figured adding the range parameters to the end would be overall less awkward than to push the radix parameter right in the new methods. The chosen implementation maintains that the second parameter is always radix, which I think helps maintain consistency.

/Claes


-Alan.

Reply via email to