# Syntax extensions for debugging?

**URL:** <https://discuss.ocaml.org/t/syntax-extensions-for-debugging/1801>\
**Category:** Community\
**Tags:** debugging, ppx\
**Created:** [March 30, 2018, 7:42pm UTC](https://discuss.ocaml.org/t/syntax-extensions-for-debugging/1801 "2018-03-30T19:42:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![examachine](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/examachine/32/505_2.png) [@examachine](https://discuss.ocaml.org/u/examachine)\
**Post date:** [March 30, 2018, 7:42pm UTC](https://discuss.ocaml.org/t/syntax-extensions-for-debugging/1801/1 "2018-03-30T19:42:46Z")

</div>

There is an extension called ppx\_show ([https://github.com/diml/ppx\_show](https://github.com/diml/ppx_show)) but it doesn’t seem to work with the latest ocaml. Does anyone know of helpful extensions for debugging?

---

<div class="post-metadata">

**Author:** ![rixed](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/rixed/32/56_2.png) [@rixed](https://discuss.ocaml.org/u/rixed)\
**Post date:** [March 31, 2018, 6:04am UTC](https://discuss.ocaml.org/t/syntax-extensions-for-debugging/1801/2 "2018-03-31T06:04:23Z")

</div>

For quick and dirty display of any value, batteries has a `dump` function.  
It does not give constructor names, though, since it reconstruct structures using only the memory layout of objects (at least that’s my memory model of it).

Other than that, there are various ppx extensions like that. I’d recomand starting from [ppx-deriving](https://github.com/ocaml-ppx/ppx_deriving). You could disable the ppx for production build, if you want to print only on debug mode.

I must confess that, by `syntax extensions for debugging` I was hoping for more than just printers. But well, it seems that’s printf-debugging is still our state-of-the-art. :-/

---

<div class="post-metadata">

**Author:** ![examachine](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/examachine/32/505_2.png) [@examachine](https://discuss.ocaml.org/u/examachine)\
**Post date:** [March 31, 2018, 6:15am UTC](https://discuss.ocaml.org/t/syntax-extensions-for-debugging/1801/3 "2018-03-31T06:15:13Z")

</div>

I found this project!

> **[dariusf/ppx\_polyprint](https://github.com/dariusf/ppx_polyprint)**
>
> A small library for convenient printf debugging and function tracing - dariusf/ppx\_polyprint

---

<div class="post-metadata">

**Author:** ![examachine](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/examachine/32/505_2.png) [@examachine](https://discuss.ocaml.org/u/examachine)\
**Post date:** [March 31, 2018, 6:15am UTC](https://discuss.ocaml.org/t/syntax-extensions-for-debugging/1801/4 "2018-03-31T06:15:39Z")

</div>

It might be nice to do better than printf debugging indeed 🙂

---

<div class="post-metadata">

**Author:** ![examachine](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/examachine/32/505_2.png) [@examachine](https://discuss.ocaml.org/u/examachine)\
**Post date:** [March 31, 2018, 4:53pm UTC](https://discuss.ocaml.org/t/syntax-extensions-for-debugging/1801/5 "2018-03-31T16:53:41Z")

</div>

Unfortunately ppx\_polyprint requires a lot of patching. I got ppx\_show to compile though.
