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
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs