[m-dev.] is_digit/1 and digit_to_int/2

Peter Wang novalazy at gmail.com
Fri Sep 5 15:41:37 AEST 2014

On Fri, 5 Sep 2014 15:12:49 +1000 (EST), Julien Fischer <jfischer at opturion.com> wrote:
> Hi,
> I think it is potentially confusing that char.is_digit/1 and
> char.digit_to_int/2 are true for different inputs.  The former only
> succeeds for 0-9, while the latter succeeds for 0-9a-zA-Z.
> At the very least I think we should have is_decimal_digit/1 and
> decimal_digit_to_int/2 that are both only true for 0-9.

Oh, I have misused char.digit_to_int at least once.  There is a buggy
use in the compiler as well (rev_find_number_suffix).

Is it too late to deprecate char.digit_to_int?  And perhaps
char.int_to_uppercase_digit, char.int_to_digit, char.det_int_to_digit?

The replacements could take an explicit base from 2 to 36.


More information about the developers mailing list