poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] pickles: add bincodec.pk


From: Jose E. Marchesi
Subject: Re: [PATCH 2/2] pickles: add bincodec.pk
Date: Thu, 26 Jan 2023 01:26:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Mohammad.

> +/* bincodec.pk - Encoders/decoders for binary data representations.
> */

Hmm, from that descritpion, it seems to me that this pickle seems to aim
at doing exactly what poke is supposed to do? i.e. to encode/decode data
to/from its binary representation?

Looking at the two proposed functions:

> +/* Given an array of bytes, generate the corresponding hex string
> +   representation.  */
> +
> +fun hex_encode = (uint<8>[] data) string:


> +/* Given a hex string (that is expected to match the following regular
> +   expression: ([0-9a-fA-F][0-9a-fA-F])*), return the corresponding
> +   byte array.  */
> +
> +fun hex_decode = (string str) uint<8>[]:

It seems to me that the domain of the pickle would be to handle
printable encodings of binary data.  Something like SREC, right?

So, i would rename the pickle to something like asciihex.pk.  If you add
nice features like specifying separators in optional arguments to the
decoder, to support "AB AB FF" or "ABCD ABCD", then such a pickle would
be very handle to implement srec.pk and similars :)

Also, please use the name of the pickle as a prefix in the exported
functions/variables.  Like:

asciihex_decode, asciihex_encode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]