ppx_deriving icon indicating copy to clipboard operation
ppx_deriving copied to clipboard

Support exceptions

Open infinity0 opened this issue 8 years ago • 3 comments

One of the uses of sexplib is to be able to pretty-print exceptions, e.g. on stack traces. Previously via the with sexp syntax one could attach these to exceptions, to achieve this. But ppx_deriving does not support exceptions, so [@@deriving sexp] annotations have no effect - e.g. see janestreet/ppx_sexp_conv#11. It would be good if this could work.

infinity0 avatar Jul 20 '16 19:07 infinity0

I don't really understand the issue, and we're using [@@deriving sexp] on exceptions in Jane Street, so presumably the issue is solved in the modern world. I'm closing the issue. Feel free to re-open if it's not, actually, solved.

aalekseyev avatar Aug 18 '20 12:08 aalekseyev

Oh, well, I don't have permissions to close an issue here.

aalekseyev avatar Aug 18 '20 12:08 aalekseyev

I'm not sure how @@deriving is supposed to work on exception declarations. For example, if you use type t = Foo [@@deriving show], you will get a show_t function generated "for free". But on exception Foo [@@deriving show], morally there should be an extensible show_exception function to which a case would be added for Foo. I suspect that this is not supported by ppx_deriving today, as reported earlier by @infinity0. @aalekseyev, you may be observing a feature implemented in ppx_type_conv? (Do you have a pointer to some documentation on the feature?)

gasche avatar Sep 15 '20 11:09 gasche