# \#metaprogramming

**URL:** https://discuss.ocaml.org/tag/metaprogramming/231.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Multi-stage programming vs. defunctionalization](https://discuss.ocaml.org/t/multi-stage-programming-vs-defunctionalization/15106)

<div class="topic-metadata">

**Author:** [@nated](https://discuss.ocaml.org/u/nated)\
**Replies:** 4\
**Last updated:** [August 8, 2024, 12:31pm UTC](https://discuss.ocaml.org/t/multi-stage-programming-vs-defunctionalization/15106 "2024-08-08T12:31:09Z")

</div>

(Hello, sorry, this may or may not be on-topic here - please let me know if I should remove it. I asked this question on ProgLangDesign on Stack Exchange and haven’t gotten any answers, and I thought maybe there would be…

---

## [Generate functions at compile time](https://discuss.ocaml.org/t/generate-functions-at-compile-time/14487)

<div class="topic-metadata">

**Author:** [@borisd](https://discuss.ocaml.org/u/borisd)\
**Replies:** 10\
**Last updated:** [April 21, 2024, 11:09pm UTC](https://discuss.ocaml.org/t/generate-functions-at-compile-time/14487 "2024-04-21T23:09:19Z")

</div>

I am new to the OCaml metaprogramming ecosystem. I would like to generate at compile time a structure with some functional values. What would be the simplest way to achieve this? Which PPXs should I look at, or should I …

---

## [Generate typed AST fragments](https://discuss.ocaml.org/t/generate-typed-ast-fragments/13824)

<div class="topic-metadata">

**Author:** [@samoht](https://discuss.ocaml.org/u/samoht)\
**Replies:** 2\
**Last updated:** [January 9, 2024, 9:13pm UTC](https://discuss.ocaml.org/t/generate-typed-ast-fragments/13824 "2024-01-09T21:13:18Z")

</div>

What’s the best way nowadays to generate a well-formed AST (optionally check that it is well-typed) and serialize it to a string? These ASTs might use some external libraries (that are not necessarily directly available …

---

## [Does BER MetaOCaml work with OCaml's LSP? (VSCode etc.)](https://discuss.ocaml.org/t/does-ber-metaocaml-work-with-ocamls-lsp-vscode-etc/11051)

<div class="topic-metadata">

**Author:** [@lukstafi](https://discuss.ocaml.org/u/lukstafi)\
**Replies:** 2\
**Last updated:** [February 18, 2023, 8:12pm UTC](https://discuss.ocaml.org/t/does-ber-metaocaml-work-with-ocamls-lsp-vscode-etc/11051 "2023-02-18T20:12:23Z")

</div>

My dune build --watch succeeds, but ocamllsp complains once the code starts using MetaOCaml’s constructs. E.g.: Undbound value \>., and it loses track of where a function body ends (annotating local definitions as topleve…

---

## [Learning to write PPX extenders: some links](https://discuss.ocaml.org/t/learning-to-write-ppx-extenders-some-links/11334)

<div class="topic-metadata">

**Author:** [@lukstafi](https://discuss.ocaml.org/u/lukstafi)\
**Replies:** 0\
**Last updated:** [February 6, 2023, 7:00am UTC](https://discuss.ocaml.org/t/learning-to-write-ppx-extenders-some-links/11334 "2023-02-06T07:00:39Z")

</div>

Hi! This is just to signal boost a couple of PPX extension examples, for extenders specifically, that I found useful in my learning. Sorry for not selecting others, I stumbled upon these. Blog post by Nathan from Tari…

---

## [BER MetaOCaml for OCaml 5.0?](https://discuss.ocaml.org/t/ber-metaocaml-for-ocaml-5-0/10995)

<div class="topic-metadata">

**Author:** [@lukstafi](https://discuss.ocaml.org/u/lukstafi)\
**Replies:** 2\
**Last updated:** [December 26, 2022, 7:30am UTC](https://discuss.ocaml.org/t/ber-metaocaml-for-ocaml-5-0/10995 "2022-12-26T07:30:13Z")

</div>

Hi! I wonder if anyone is looking into bringing BER MetaOCaml up to OCaml 5.0? With the excellent work by Oleg Kiselyov, this does not seem daunting. My thinking is we could use the opportunity to give up on the non-sta…

---

## [Optimising an interpreter](https://discuss.ocaml.org/t/optimising-an-interpreter/10874)

<div class="topic-metadata">

**Author:** [@Jon\_Harrop](https://discuss.ocaml.org/u/Jon_Harrop)\
**Replies:** 5\
**Last updated:** [November 29, 2022, 2:43pm UTC](https://discuss.ocaml.org/t/optimising-an-interpreter/10874 "2022-11-29T14:43:40Z")

</div>

If I have an interpreter written in OCaml and I want it to run code faster without the burden of having to write a compiler what are my options? I could use MetaOCaml and do staged metaprogramming. Should be easy and ac…

---

## [Code execution in compile time](https://discuss.ocaml.org/t/code-execution-in-compile-time/10725)

<div class="topic-metadata">

**Author:** [@egoholic](https://discuss.ocaml.org/u/egoholic)\
**Replies:** 5\
**Last updated:** [November 10, 2022, 7:15pm UTC](https://discuss.ocaml.org/t/code-execution-in-compile-time/10725 "2022-11-10T19:15:05Z")

</div>

I’ve not used PPX yet, but the examples of its use looks ugly to me (sorry, but that’s mine opinion as unexperienced developer in OCaml). Few years ago I came to the idea of let’s call it staged execution, when we have a…

---

## [Atdpy: derive safe JSON interfaces for Python](https://discuss.ocaml.org/t/atdpy-derive-safe-json-interfaces-for-python/9544)

<div class="topic-metadata">

**Author:** [@mjambon](https://discuss.ocaml.org/u/mjambon)\
**Replies:** 2\
**Last updated:** [March 24, 2022, 9:35pm UTC](https://discuss.ocaml.org/t/atdpy-derive-safe-json-interfaces-for-python/9544 "2022-03-24T21:35:13Z")

</div>

On behalf of the ATD team, I’d like to announce atdpy, which is part of the release 2.3.x of the ATD tools. For now, the best installation method with via opam: $ opam install atdpy Atdpy is a new backend for ATD. It t…

---

## [Functori is hiring full-time engineers & Interns](https://discuss.ocaml.org/t/functori-is-hiring-full-time-engineers-interns/9266)

<div class="topic-metadata">

**Author:** [@iguerNL](https://discuss.ocaml.org/u/iguerNL)\
**Replies:** 0\
**Last updated:** [February 2, 2022, 4:14pm UTC](https://discuss.ocaml.org/t/functori-is-hiring-full-time-engineers-interns/9266 "2022-02-02T16:14:02Z")

</div>

Hello OCaml community, Functori, a young and dynamic company based in Paris, is hiring talented engineers/PhDs to expand its team. Please find more details in the announcement (in French): https://functori.com/annonce-r…

---

## [Adding attributes using ppxlib.metaquot](https://discuss.ocaml.org/t/adding-attributes-using-ppxlib-metaquot/9142)

<div class="topic-metadata">

**Author:** [@orbitz](https://discuss.ocaml.org/u/orbitz)\
**Replies:** 7\
**Last updated:** [January 15, 2022, 12:42pm UTC](https://discuss.ocaml.org/t/adding-attributes-using-ppxlib-metaquot/9142 "2022-01-15T12:42:51Z")

</div>

Is it possible to add attributes to values using ppxlib.metaquot? I am doing code generation that I will print out via Pprintast and I what to use \[@@deriving show\] in that output: the following is not working: \[%stri …

---

## [\[ANN\] First release of metapp](https://discuss.ocaml.org/t/ann-first-release-of-metapp/5250)

<div class="topic-metadata">

**Author:** [@thierry-martinez](https://discuss.ocaml.org/u/thierry-martinez)\
**Replies:** 2\
**Last updated:** [March 3, 2020, 12:50pm UTC](https://discuss.ocaml.org/t/ann-first-release-of-metapp/5250 "2020-03-03T12:50:43Z")

</div>

I am happy to announce the first release of metapp, yet another preprocessor for OCaml. Similarly to ppx\_optcomp, metapp is a PPX rewriter. But instead of introducing a specific DSL for preprocessor directives, metapp …

---

## [Generation of OCaml code](https://discuss.ocaml.org/t/generation-of-ocaml-code/2159)

<div class="topic-metadata">

**Author:** [@egoholic](https://discuss.ocaml.org/u/egoholic)\
**Replies:** 12\
**Last updated:** [June 28, 2018, 6:37pm UTC](https://discuss.ocaml.org/t/generation-of-ocaml-code/2159 "2018-06-28T18:37:11Z")

</div>

I’m working on router in which I would describe routes using S-expressions (sexplib), for example see the screenshot below. What is the best way to translate S-expressions in OCaml while building (I use Dune/Jbuilder)? I…
