Skip to content
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

[tips] prioritized bubble opening #625

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

clembu
Copy link
Contributor

@clembu clembu commented May 3, 2021

Adds a priority parameter to Os_tips.bubble,
and changes the tips system to open bubbles on a given order.

Behaviour on absent priority is unchanged.

Adds a `priority` parameter to `Os_tips.bubble`,
and changes the tips system to open bubbles on a given order.
(* We wait for the elements to load,
to be sure we have all waiters prioritized *)
let%lwt () = onload_waiter () in
if not !sorted then
Copy link
Member

Choose a reason for hiding this comment

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

ocamlformat failed. We should probably add a commit hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

failed? Do we have a .ocamlformat in this repo?

Copy link
Member

Choose a reason for hiding this comment

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

Damned. Only in the template 😭

to be sure we have all waiters prioritized *)
let%lwt () = onload_waiter () in
if not !sorted then
(prioritized_waiters := List.rev !prioritized_waiters; sorted := true);
Copy link
Member

Choose a reason for hiding this comment

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

Why not sorting in reverse order directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would reverse the call-order too. On priority equality, first calls are inserted first, thus later in the list. We have no other reliable way to keep this order than reversing the list.

Copy link
Member

Choose a reason for hiding this comment

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

ok thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That said, I'm currently sorting the list on every addition, which is suboptimal. I'll move the sort to this place so we only do it once (per batch)

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.

2 participants