The Metalang99 Standard Library

The Metalang99 standard library exports a set of macros implemented using the Metalang99 metalanguage.


  • A plain macro is a macro whose result can be computed only by preprocessor expansion.

  • A Metalang99-compliant macro is a macro called through ML99_call/ML99_callUneval, directly or indirectly. To compute its result, the Metalang99 interpreter is needed.

  • A desugaring macro is a convenience macro X(params…) which expands to ML99_call(X, params…) so that you can invoke X as X(v(1), v(2), v(3)). Desugaring macros are provided for all public Metalang99-compliant macros.

Naming conventions

  • Plain macros follow the SCREAMING_CASE convention.

  • Metalang99-compliant macros follow the camelCase convention.

  • Macros denoting language terms (defined by lang.h) follow the camelCase convention.

Sometimes, there exist two versions of the same macro: one is plain, and the other is Metalang99-compliant. For example, here are two complete metaprograms, one using ML99_untuple and the second one using ML99_UNTUPLE:

ML99_EVAL(ML99_untuple(v((1, 2, 3))))
ML99_UNTUPLE((1, 2, 3))

Both metaprograms result in 1, 2, 3.

Version manipulation macros

The following macros are defined in metalang99.h.

ML99_MAJOR, ML99_MINOR, and ML99_PATCH denote the major, the minor, and the patch version numbers, respectively.

ML99_VERSION_COMPATIBLE(x, y, z) and ML99_VERSION_EQ(x, y, z) are function-like macros that expand to a constant boolean expression:

  • The former holds iff the current Metalang99 version is at least vx.y.z in a SemVer-compatible way. Thus, if the current version is v1.2.3, then ML99_VERSION_COMPATIBLE will hold for v1.2.3, v1.2.6, v1.6.0, but not for v2.5.0 or v3.0.0.

  • The latter one holds iff the version is exactly vx.y.z.

These macros can be used as follows:

#error Please, update your Metalang99 to v1.2.3 or higher!


Indices and tables