Skip to content

Conversation

@rgrinberg
Copy link
Contributor

@rgrinberg rgrinberg requested a review from a user April 12, 2018 16:13
Copy link

@bikallem bikallem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgrinberg This is nice. I was experimenting with cppo but this is even cleaner and much better. 👍

(lwt lwt_react zed
(select lTerm_sequence.ml from
(lwt.unix -> lTerm_sequence_lwt3.ml)
(lwt-unix -> lTerm_sequence_lwt4.ml))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think lwt 4.0.0 still defines lwt.unix findlib package as lwt.unix and not lwt-unix. See https://github.com/ocsigen/lwt/blob/master/src/unix/jbuild#L56. Isn't the dune (library (public_name) field the findlib package name?

Incidentally, I tried ocamlfind query lwt-unix and it returns with ocamlfind: Package `lwt-unix' not found. and when I do ocamlfind query lwt.unix it returns the correct correct path.

cc @aantron. Were you looking to rename lwt.unix to lwt-unix in lwt 4.0.0?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, lwt.unix is correct, and we haven't renamed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, ok so we'll need a different check. Unfortunately, we might not be able to do with a select form anymore, which will complicate things.

ignore (Lwt_unix.on_signal signum (fun _ -> send_resize ()))
with Not_found ->
ignore (Lwt_sequence.add_r send_resize Lwt_main.enter_iter_hooks)
ignore (LTerm_sequence.add_r send_resize Lwt_main.enter_iter_hooks)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this will compile. Is 'a LTerm_sequence.t = 'a Lwt_sequence.t? If so, how may I ask?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkout the lwt3.mli. We are making sure 'a LTerm_sequence.t = Lwt_sequence.t


exception Empty

type 'a t = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this will work. Will this 'a t be = to 'a Lwt_sequence.t? Pls seem my comment on lTerm.ml above. How is this type equality established?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the type equality for Lwt4 since Lwt_sequence isn't going to be present, right?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I think we do since we use Lwt_main.enter_iter_hooks which returns Lwt_sequence.t. My initial attempt got stuck here since I couldn't establish equality between the two types.

@rgrinberg
Copy link
Contributor Author

Btw, @bikallem this PR is just a POC. Feel free to take this and incorporate into your own PR. I think what's left to make this work is to have a proper way to detect lwt3 vs lwt4. I don't think jbuilder currently has a way to get the version number of external packages. That's a bit of a shame, though easily fixable in dune.

Btw, testing things based on version number can be a bit brittle. I wish there was a way to simply check if the library has a certain module or not. But constructing such a capability based test is too involved at the moment unfortunately.

@bikallem
Copy link

@diml @rgrinberg Based on the comment from @aantron.(ocsigen/lwt#573 (comment)) I think the relatively straightforward approach for now is to disable the deprecation warning. We will probably have to revisit this once lwt release a version without Lwt_sequence. Is this okay?

@aantron
Copy link

aantron commented Apr 13, 2018

@bikallem The "best" course of action depends on whether Lwt_sequence is part of Lambda-Term's API or not. I know it's mentioned in one .mli file, but it I'm not sure if that interface is "internal" to Lambda-Term or meant to be used by users. utop doesn't seem to use it, for example. So, it is part of the API?

If you disable the deprecation warning, I recommend doing it locally for expressions and/or declarations, not files or libraries.

@bikallem
Copy link

Thanks. Noted re: deprecating locally only.

@rgrinberg rgrinberg closed this Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants