[wg-camlp4] My uses of syntax extension

Lukasz Stafiniak lukstafi at gmail.com
Mon Jan 28 16:22:15 GMT 2013


I forgot to mention that we also use optional compilation "IFDEF" / "ELSE".

On Mon, Jan 28, 2013 at 3:08 PM, Anil Madhavapeddy <anil at recoil.org> wrote:
> On 25 Jan 2013, at 20:52, Lukasz Stafiniak <lukstafi at gmail.com> wrote:
>
>> My uses of camlp4:
>> - "let try n = expr in expr with handlers"
>> - LOGging
>> - recently, matrix access/assignment like in bigarrays but for
>> built-in arrays (long ago I also played with matlab-like notation)
>> - js_of_ocaml
>> - list comprehensions and pa_monad, but for educational purposes so far.
>
> Could you expand on the logging and matrix ones (are they online anywhere?)
>
> I'm interested in a universal logging extension that makes it easier to introduce lazy logging statements through code, but the existing ones are all a bit tied to their frameworks (e.g. Lwt_log).

http://sourceforge.net/p/toss/code-0/1821/tree/trunk/Toss/caml_extensions/pa_log.ml

> Is the matrix access one just a variant of x.{4}.{5}, or does it do something cunning to reshape 2D arrays as well?

The syntax is x.(4,5) and it currently translates into x.(4).(5); it
might be reasonable to use flat arrays but the main purpose is
readability.

http://sourceforge.net/p/toss/code-0/1821/tree/trunk/Toss/caml_extensions/pa_matrix.ml


More information about the wg-camlp4 mailing list