caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@janestreet.com>
To: David Allsopp <dra-news@metastack.com>
Cc: OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] [ANN] BitMasks 1.0.0
Date: Wed, 19 Mar 2014 08:30:58 +1100	[thread overview]
Message-ID: <CACLX4jRwV3yxoMhA=9jnihK7w2ABmSmzu=4wUAX=2kNYO0wykA@mail.gmail.com> (raw)
In-Reply-To: <000001cf42ed$400203f0$c0060bd0$@metastack.com>

[-- Attachment #1: Type: text/plain, Size: 2470 bytes --]

You might be interested also in the Flags module in Core_kernel, which aims
to serve a similar purpose.

https://ocaml.janestreet.com/ocaml-core/111.03.00/doc/core_kernel/#Flags
https://github.com/janestreet/core_kernel/blob/master/lib/flags.ml
https://github.com/janestreet/core_kernel/blob/master/lib/flags.mli
https://github.com/janestreet/core_kernel/blob/master/lib/flags_intf.ml

y


On Wed, Mar 19, 2014 at 8:01 AM, David Allsopp <dra-news@metastack.com>wrote:

> Firstly, many thanks for the various replies to my earlier request for
> pointers and guidance on packaging earlier this month.
>
> I'm pleased to announce the release of BitMasks 1.0.0. This library is
> designed primarily with C bindings in mind and is yet another solution to
> the "how do we manipulate integer bitmask flags functionally" problem. So,
> given an integer where bit 0 means something, bit 1 means something else
> and
> bit 2 yet something further, this library allows that to be exposed as type
> t = Foo | Bar | Baz and have the integer be constructed as though it were a
> set.
>
> This implementation has three key features:
> * Underlying type is provided through a functor (so int or int64 or indeed
> an arbitrary precision integer can be used)
> * There's no copying, so the original integer can still be used (either
> internally or, at the whim of the programmer, the integer can be exposed).
> This has significant advantages over, for example, returning the a list of
> the bits which are set.
> * The resulting signature is compatible with Set.S in the standard library
>
> Project home: http://forge.ocamlcore.org/projects/bitmasks/
> Repository: https://github.com/meta-stack/bitmasks
> OPAM package: bitmasks
>
> The source includes a full example. I believe having looked at other code
> out there that Core follows a similar philosophy.
>
> The original motivation for this library was to provide a sane handling for
> the myriad masks of information returned by ODBC's SQLGetInfo function, but
> I've found it be useful in other bindings as well (particularly for
> bindings
> for some Raspberry Pi components which I hope to release soon) and hope
> others may do too.
>
> Happy functional bit set manipulating!
>
>
> David
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 3775 bytes --]

      reply	other threads:[~2014-03-18 21:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 21:01 David Allsopp
2014-03-18 21:30 ` Yaron Minsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACLX4jRwV3yxoMhA=9jnihK7w2ABmSmzu=4wUAX=2kNYO0wykA@mail.gmail.com' \
    --to=yminsky@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=dra-news@metastack.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).