[m-rev.] for review: format uints directly

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Nov 19 23:10:25 AEDT 2020


2020-11-19 22:17 GMT+11:00 "Julien Fischer" <jfischer at opturion.com>:
> For review by anyone.

I will review it tomorrow morning.

> I would also like feedback on:
> 
> 1. Should we add to X_to_hex_string/1 and X_to_octal_string/1 to the
> string module for all integer types?

It could be useful sometime, but it is far from urgent.

> 2. Should we add X_to_binary_string/1 to the string module for all
> integer types?

Likewise, but even less urgent.

> 3. If we do, should X_to_{hex,octal,binary}_string return the string
> representation of their argument as unsigned for signed integer types?

Sometimes, when converting a signed int to e.g. hex, one wants effectively
uint_to_hex(uint.cast_from_int(N)), and sometimes one wants uint_to_hex(
uint.cast_from_int(int.abs(N))) with possibly a minus sign in front of it.
People who want the former can easily write it themselves; the latter could
use a trivial library function.

Zoltan.


More information about the reviews mailing list