Previous Contents Next
Chapter 7 Language extensions

This chapter describes the language features that are implemented in Objective Caml, but not described in the Objective Caml reference manual. In contrast with the fairly stable kernel language that is described in the reference manual, the extensions presented here are still experimental, and may be removed or changed in the future.

7.1 Streams and stream parsers

Streams and stream parsers are no longer part of the Objective Caml language, but available through a CamlP4 syntax extension. See the CamlP4 reference manual for more information. Objective Caml programs that use streams and stream parsers can be compiled with the -pp camlp4o option to ocamlc and ocamlopt.

7.2 Range patterns

In patterns, Objective Caml recognizes the form ' c ' .. '  d ' (two character literals separated by ..) as shorthand for the pattern
' c ' | '  c1 ' | '  c2 ' | ... | '  cn ' | '  d '
where c1, c2, ..., cn are the characters that occur between c and d in the ASCII character set. For instance, the pattern '0'..'9' matches all characters that are digits.

7.3 Assertion checking