Open cmxog opened 2 years ago
That's a good question. The issue with the open type is, of course, that we lose all exhaustiveness checks (so you risk meeting an error at runtime). Passing an extension_handler
is of course doable.
I'm not in favor or removing view
but it could have an open case:
type ext_view = ..
type view =
| Empty
| Text of { … }
| Extension of ext_view
and then make extension_handler
optional?
I think this sounds like a sensible approach.
I could implement this (eventually) because I have a use-case for it: flame graphs. Questions to consider before resorting to extensions:
Hi,
First of all, thank you for such a great library!
I wonder if you guys have considered an extensibility story for printbox. I know you've made
t
opaque andview
private in 0.2 (I am not 100% sure about the reasoning here) but have you thought about allowing end-users to add their own constructs ift
was made extensible instead (I guess that would makeview
go away?)Where printers like
text
orhtml
would have a way to pass a handler for a catch-all match that is not handled by the library itself? Something like