[m-dev.] Binary data and UTF-8

Julien Fischer juliensf at csse.unimelb.edu.au
Mon May 14 13:22:54 AEST 2012


On Fri, 11 May 2012, Peter Wang wrote:

> On Fri, 11 May 2012 14:00:41 +1000 (EST), Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>
>> On Fri, 11 May 2012, Peter Wang wrote:
>>
>>> And my general complaint: working with bits is annoying and error prone.
>>> We don't necessarily need a new type, just a module that provides a
>>> byte-oriented interface on top of bitmap.
>>
>> Isn't there already a byte-orinted interface on top of it?
>
> Not for these.
>
>     :- func init(num_bits::in, bool::in) = (bitmap::bitmap_uo) is det.
>     :- func init(num_bits::in) = (bitmap::bitmap_uo) is det.
>     :- func resize(bitmap, num_bits, bool) = bitmap.
>     :- func shrink_without_copying(bitmap, num_bits) = bitmap.
>
> Some of the bit versions have taken the obvious names, and nothing
> prevents me calling those by accident, e.g. those above, in_range,
> slice.
>
> Other obvious names that are unusable:
>
>    :- func size(bitmap) = num_bytes.
>    :- pred get(bitmap, int, byte).
>    :- pred set(int, byte, bitmap, bitmap).

That's a fair point - perhaps we should just add a byte_array module
to the standard lib and be done with it.

Julien.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list