You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a priority queue used only internally in Lwt_engine to sort threads waiting for timeouts.
The interface apparently has nothing to do with Lwt, i.e. it is just a regular priority queue that could be implemented by any library, and is not aware of anything Lwt provides, nor is mentioned in any other Lwt signature. This makes me think that this module should not be part of the Lwt API.
I suggest that we document this module as deprecated, and remove it from the API in the future (not soon – have to give non-OPAM users a chance to react). @talex5, what do you think?
@antoine1fr As for producer-consumer systems, if this is still an issue, you may want to look at Lwt_stream, or the separate, but quite nice, Lwt_pipe. Depending on your needs, you can also roll your own using Lwt_condition + Lwt_mutex + any data structure you want, as we discussed in the other issue :)
Not sure about this. The same argument could be used about Lwt_sequence. They're both commonly-useful data structures and neither depends on Lwt. Both could be moved to a general utility library (or even to the standard library).
Perhaps we could suggest adding these to the standard OCaml library and remove them from Lwt when/if the stdlib provides an alternative? I agree Lwt isn't really the right place to define them, but they've been there for a while and aren't really doing any harm. Documentation would be good, though...
Lwt_sequence would be nice to move out too, but unlike Lwt_pqueue, it is used in other places in the API (example) – although, perhaps, it shouldn't be. Lwt_pqueue is AFAICT purely an implementation detail at this point, when considering only Lwt.
Perhaps we could suggest adding these to the standard OCaml library and remove them from Lwt when/if the stdlib provides an alternative? I agree Lwt isn't really the right place to define them, but they've been there for a while and aren't really doing any harm. Documentation would be good, though...
I think this is a good idea. It's probably best to mark Lwt_pqueue deprecated now, to discourage its use in new code, but I will keep it around for the foreseeable future. In the meantime, we can try to get it added to stdlib or factor it out somehow. Lwt_sequence probably should get similar treatment, but I'd have to look into it more carefully first due to its usage in the API.
See attached commit. The docs should also soon be visible here.
EDIT: looking into the broken external links...
@talex5 I do an OPAM search before removing anything, so I will let you know if I start heading towards actually getting rid of this module. It won't be soon, and you shouldn't have to do anything in the meantime.
Activity
aantron commentedon Jul 3, 2016
It is a priority queue used only internally in
Lwt_engineto sort threads waiting for timeouts.The interface apparently has nothing to do with Lwt, i.e. it is just a regular priority queue that could be implemented by any library, and is not aware of anything Lwt provides, nor is mentioned in any other Lwt signature. This makes me think that this module should not be part of the Lwt API.
Among OPAM packages depending on Lwt, it is used only in project
mirage-platform.I suggest that we document this module as deprecated, and remove it from the API in the future (not soon – have to give non-OPAM users a chance to react). @talex5, what do you think?
aantron commentedon Jul 3, 2016
@antoine1fr As for producer-consumer systems, if this is still an issue, you may want to look at
Lwt_stream, or the separate, but quite nice,Lwt_pipe. Depending on your needs, you can also roll your own usingLwt_condition+Lwt_mutex+ any data structure you want, as we discussed in the other issue :)talex5 commentedon Jul 3, 2016
Not sure about this. The same argument could be used about
Lwt_sequence. They're both commonly-useful data structures and neither depends on Lwt. Both could be moved to a general utility library (or even to the standard library).I see I used
Lwt_pqueuein CueKeeper too: https://github.com/talex5/cuekeeper/blob/master/tests/test.ml#L19Perhaps we could suggest adding these to the standard OCaml library and remove them from Lwt when/if the stdlib provides an alternative? I agree Lwt isn't really the right place to define them, but they've been there for a while and aren't really doing any harm. Documentation would be good, though...
aantron commentedon Jul 3, 2016
Lwt_sequencewould be nice to move out too, but unlikeLwt_pqueue, it is used in other places in the API (example) – although, perhaps, it shouldn't be.Lwt_pqueueis AFAICT purely an implementation detail at this point, when considering only Lwt.I think this is a good idea. It's probably best to mark
Lwt_pqueuedeprecated now, to discourage its use in new code, but I will keep it around for the foreseeable future. In the meantime, we can try to get it added to stdlib or factor it out somehow.Lwt_sequenceprobably should get similar treatment, but I'd have to look into it more carefully first due to its usage in the API.I'll add docs in the meantime as well.
aantron commentedon Jul 4, 2016
See attached commit. The docs should also soon be visible here.
EDIT: looking into the broken external links...
@talex5 I do an OPAM search before removing anything, so I will let you know if I start heading towards actually getting rid of this module. It won't be soon, and you shouldn't have to do anything in the meantime.
talex5 commentedon Jul 4, 2016
Thanks (and the new docs look good!).
Deprecate Lwt_sequence
Document and deprecate Lwt_pqueue