Skip to content

Comment on Pain Points of OCamlparent

Comments

That's slightly disingenuous, as in the case of ppx_deriving you always need to state the type of the expression to call it, e.g.

    show_file
or
    [%derive.show: (int * int) list]
from the page. It's basically the same story for Format.

What many other languages do that if you have an object, you can just transform that object into a string or output it with debug formatting, without any particular support from the object. It isn't much of a chore, but it is some; and polymorphic functions now need one extra argument for the formatter.

I do recall there's a module for OCaml that can do "debug level" printing of objects by traversing their runtime structure, but that of course doesn't suite all objects.

At least in Rust it's not automatic that you can print an object in the first place :).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.