Re: Hex encoding functions on the binary module

Max Lapshin <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAMxVRxBXDPNSxvCawD=ih08f13Q3Ypfz42KqNvFDGm0rAXswgg@mail.gmail.com>
Excellent!

We all have this code in each project =)

On Sat, Jan 30, 2021 at 11:22 AM Bryan Frimin <[email protected]> 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
> [email protected]
>
> [1] https://github.com/erlang/otp/pull/3014
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.