List Info

Thread: "ocaml_beginners"::[] camlp4/examples/apply_operator question




"ocaml_beginners"::[] camlp4/examples/apply_operator question
country flaguser name
Germany
2007-06-07 23:53:39

While learning about he new Camlp4 code I came across the apply operator
example provided with the OCaml 3.10.0 sources:

The ( & ) apply operator is implemented as a camlp4 filter in
apply_operator.ml:

----------------------------------------------------------
open Camlp4.PreCast;
AstFilters.register_str_item_filter
(Ast.map_expr
(fun
[ <:exprloc< $e1$ & $e2$ >> -> <:exprloc< $e1$ $e2$ >>
| e -> e ]))#str_item;
----------------------------------------------------------

And its use is demonstrated in apply_operator_test.ml:

----------------------------------------------------------
let ( & ) = ();; (* To force it to be inlined. If not it's not well typed. *)

fun f g h x -> f& g& h x
----------------------------------------------------------

I do not understand the comment and even after removing the first line
everything seems to still work fine.

Any explanations welcome! TIA.

--
Chris Stork <> Support eff.org! <> http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )