Browse thread
ANNOUNCE: pa_bitmatch 0.5
- Richard Jones
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Richard Jones <rich@a...> |
| Subject: | ANNOUNCE: pa_bitmatch 0.5 |
I'm pleased to announce the (experimental) version 0.5 of pa_bitmatch,
the syntax extension that adds Erlang-style bit strings and bit string
matching to OCaml.
http://et.redhat.com/~rjones/bitmatch/
In this release:
- The "bitmatch" operator has been rewritten to use patterns
properly (before it was using a hack involving expressions).
One consequence of this is that you can now use all the
features of OCaml patterns, eg:
bitmatch packet with
| { ((4|6) as ip_version) : 4 } ->
printf "I understand IPv4 or v6, this is version %d\n" ip_version
- You can now match and construct using plain strings:
bitmatch file with
| { "MAGIC" : 40 : string } -> ...
- Error messages are now localized all the way down to individual
fields in the pattern, which makes it a lot easier to chase
errors.
- You need to put { ... } around all fields. Sorry, this breaks
the syntax, but (a) it makes it much easier to use the extension
with common editors, and (b) it's a very simple mechanical change
to existing code. I'll try not to change the syntax again if
I can avoid it.
Rich.
--
Richard Jones
Red Hat