Hex encoding functions on the binary module

Max Lapshin max.lapshin@REDACTED
Sat Jan 30 21:10:45 CET 2021


Excellent!

We all have this code in each project =)

On Sat, Jan 30, 2021 at 11:22 AM Bryan Frimin <bryan@REDACTED> wrote:
>
> Hello everyone,
>
> I propose to add the encode_hex/1, encode_hex/2 and decode_hex/1
> functions on the binary module[1].
>
> Dealing with the hex format is frequent in many codebases. At this time,
> we all copy-paste similar helpers in our codebases to encode and decode
> a hex-encoded binary.
>
> It's why I suggest enriching the binary module with these functions.
>
> I've added these functions on the binary module because it makes sense
> to me, and it avoids polluting the global namespace with a new
> module. Maybe create a new module called hex, for example, is a better
> solution.
>
> I tried as much as possible to follow the contribution guide. Don't
> hesitate to tell me if I made a mistake somewhere.
>
> Regards,
>
> --
> Bryan Frimin
> https://www.frimin.fr
> bryan@REDACTED
>
> [1] https://github.com/erlang/otp/pull/3014


More information about the erlang-questions mailing list