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

API changes/renames: interrupt scopes #1

Open
maxfischer2781 opened this issue Apr 4, 2019 · 1 comment
Open

API changes/renames: interrupt scopes #1

maxfischer2781 opened this issue Apr 4, 2019 · 1 comment
Labels
API the way people interact with the framework

Comments

@maxfischer2781
Copy link
Contributor

The InterruptScope is currently available as usim.until:

async with until(time==20):
    ...

This gives the appearance that it works like a loop (while vs. until) and does not reflect the interrupt aspect much.

Possible alternatives:

  • Speaking with out or with draw:
async with out(time==20):
    ...
async with draw(time==20):
    ...

Visually, a leading _ could reflect the connection to the with:

async with _out(time==20):
    ...

However, leading _ has reserved meaning in Python.

@maxfischer2781 maxfischer2781 added the API the way people interact with the framework label Apr 25, 2019
@maxfischer2781
Copy link
Contributor Author

An alternative would be unless:

async with unless(time==20):
    ...

It could (not entirely sure yet) also be possible to use conditions/notifications directly:

async with time == 20:  # abort if time != 20
    ...

Though the current behaviour only makes sense for invertible conditions:

async with ~flag:  # abort if flag is set
    ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API the way people interact with the framework
Projects
None yet
Development

No branches or pull requests

1 participant