-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the Lwt PPX inside Lwt #912
Comments
It sounds very nice to me. How about you? @raphael-proust |
I tend to prefer not using ppx but that's partly a personal preference. In fact, I have only three (hand-wave) rational (/hand-wave) and non-minor concerns:
These are my three concerns. They are not necessarily blocking, but I'd like to hear opinions on them. |
Hey, thanks for this discussion! To give my perspective (as a ppxlib maintainer) on the concerns raised:
I agree here. To write and maintain a PPX in a central project like Lwt it's important to have some expertise, also because ppxlib is lacking some documentation on good standards and more advanced features (although we'll try to find time to improve our documentation). In case that helps: feel free to ping me whenever you have a PPX question/doubt.
I think you might be referring to the situation before the "Astlib + upgrade PPXs plan" (which we started with about a year ago). Is that possible? If you're referring to something more recent, I'd be very interested if you could give some more detail. The current situation is the following (there's more info on my discuss post from July): We're collaborating with the OCaml release team and the opam team to make sure that the PPX ecosystem is always compatible with the newest release; e.g. We still need to bump the ppxlib AST to the newest version frequently. I think that's what you have in mind with
And it's true: that used to be a problem for all AST bumps before
Most of the time, you won't have to do anything. In the case that the new OCaml version touches an AST node that your PPX manipulates with ppxlib's low-level API, the opam team will add an upper ppxlib bound on LWT and we (the ppxlib team) will send you a few-lines patch PR that you can merge to be compatible again with the latest ppxlib version. It's not a big deal if that takes some months, since also the pen-ultimate ppxlib version is compatible with the latest compiler; it's just doesn't support its newest features.
Yes.
Also yes (as explained in more detail two paragraphs above.)
Ppxlib only depends on |
I would like say to that Then, if the |
I have converted Lwt_list, by hand, to the form that it would have with the ppx. I've pushed the experiment on https://github.com/raphael-proust/lwt/tree/experiment-with-backtrace-bind It's clearly less readable. And unlike the ppx, the location might be somewhat inexact by reporting the reraise function. Still, it's not completely unreadable and the location should be accurate enough. Maybe we can increase the readability with first-class modules? Instead of |
Hi all,
I've been using Lwt intensively for quite some time now, and one of my pain points is the exception handling support, namely the erase of the backtraces which makes locating the origin of the exception extremely painful (and I love to complain about it). Would it make sense to convert the code of Lwt itself to using the ppx? That way backtraces would be preserved at least inside Lwt, and it could also promote the use of the ppx.
Considering that the issue tracking explicit backtrace handling (#720) hasn't seen any progress in the past couple of years, I'm thinking it could be a good temporary (for the next 2 years) tradeoff.
I have conflicted view about the ppx: it some cases it hurts readability (but come on, everything's better than
>>= fun ->
) but it's also closer to the direct-style. I would have liked to switch to binding operators too, but they don't offer the full feature set the ppx has. The killer feature being of course the improvement in usability.I'd be willing to write the patch to transition, maybe in a couple of weeks. Would you be interested in it? I'd like to have an idea first, as not to waste time on sed scripts or refactoring ppx'es. Would there be any technical drawbacks to switching to the ppx?
Thanks!
The text was updated successfully, but these errors were encountered: