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

Change order of arguments when controlling context #6357

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

hubertp
Copy link
Collaborator

@hubertp hubertp commented Apr 19, 2023

Pull Request Description

https://github.com/orgs/enso-org/discussions/6344 requested to change the order of arguments when controlling context permissions.

Important Notes

The change brings it closer to the design doc but IMHO also a bit cumbersome to use (see changed tests) - applications involving default arguments don't play well when the last argument is not the default 🤷 .`

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.

https://github.com/orgs/enso-org/discussions/6344 requested to change
the order of arguments when controlling context permissions.
This brings is closer to the design doc but also a bit cumbersome to use
(see changed tests) which don't play well with default arguments.
@hubertp hubertp added the CI: No changelog needed Do not require a changelog entry for this PR. label Apr 19, 2023
Copy link
Member

@jdunkerley jdunkerley left a comment

Choose a reason for hiding this comment

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

Thanks for this @hubertp - hopefully we can try it in anger soon and then we can revisit if we need to.

Comment on lines -181 to +182
with_enabled_context : Context -> Function -> Text -> Any
with_enabled_context context ~action environment=Runtime.current_execution_environment = with_enabled_context_builtin context action environment
with_enabled_context : Context -> Text -> Function -> Any
with_enabled_context context environment=Runtime.current_execution_environment ~action = with_enabled_context_builtin context environment action
Copy link
Member

Choose a reason for hiding this comment

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

If the default is not last, is there any reason to keep the default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You can still invoke with a named action argument and make use of the default (see one of tests). I'm happy to adapt it, obviously, depending on how things develop during testing of execution contexts.

@hubertp hubertp added the CI: Ready to merge This PR is eligible for automatic merge label Apr 19, 2023
@mergify mergify bot merged commit f288198 into develop Apr 19, 2023
@mergify mergify bot deleted the wip/hubert/context-control-change-order branch April 19, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants