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

Enrich shutdown button #177

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@frankmcsherry
Copy link
Member

commented May 13, 2019

This PR adds a press_on_drop method to ShutdownButton, which changes its behavior to shut down an import when the button is dropped. If this method is not called then dropping the button will not shut down the import.

@comnik

@comnik

This comment has been minimized.

Copy link
Contributor

commented May 14, 2019

I have no strong opinions here. From 3DF experience, I'd say implementing "press-on-drop" within a different ShutdownHandle type might be an interesting alternative and could serve the additional purpose of bundling many shutdown buttons into a shutdown handle for an entire plan.

I'm a bit worried that the solution in this PR could lead to confusion when dealing with multiple shutdown handles, not knowing which of them will be pressed on drop and which won't.

@utaal

This comment has been minimized.

Copy link
Member

commented May 16, 2019

I'm a bit worried that the solution in this PR could lead to confusion when dealing with multiple shutdown handles, not knowing which of them will be pressed on drop and which won't.

My two cents: I’m a fan of using a separate type for representing these kinds of different states. What about a ‘fn press_on_drop(self)’ that consumes self and returns a ShutdownButtonOnDrop (or similar) instead of mutating in place?

@frankmcsherry

This comment has been minimized.

Copy link
Member Author

commented May 16, 2019

Multiple types makes a lot of sense! Tbh, the PR was about floating an idea, and I'm not 100% clear on whether it is a good idea at all. Though, I now 100% agree that one should change the type if one wants a press_on_drop button! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.