Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of env.exit() we now have exit(cap: WorldCap, exit_code: int) as a builtin function. The primary benefit is that functions are executed synchronously unlike actor methods which are async. Thus, env.exit() typically required using
await async env.exit(0)
whereas as a function it is called as a synchronous procedure, soexit(env.cap, 0)
is enough.Having to add
await async
meant users could do the wrong thing. With exit() as a function, there is no ambiguity. The user cannot do anything wrong! Also, this is shorter and more to the point. Less confusing to new usres. The only weird thing now is the capability argument...I think we should have a new ExitCap capability, but I want to keep down the amount of clutter right now, in particular for something as important as 'exit'. Beginners will see it early and it's scary when it look all too scary. Accepting WorldCap means we can do
exit(env.cap, 0)
otherwise it would probably be likeexit(ExitCap(env.cap), 0)
and it's just extra bits complicating things. I think we should have ExitCap but as exit() is so common that it should be acceptable to use WorldCap directly. For the few programs where one actually wants to delegate a restricted ExitCap capability, that should be possible to by having an ExitCap but it would require exit() to accept a union, either an ExitCap or WorldCap. We don't have unions yet, so it will have to wait.Fixes #1028