Introduce Interface helper to allow calling protocol functions #159
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.
This allows for rewriting functions to receive protocols as arguments, an example of this is the now rewritten
Iterator::chain
:This used to receive
other: Iterator
, meaning the caller has to convert the argument into an iterator. This is now instead done in the caller.This requires the addition of a thread-local and a little bit of unsafe. Without this, we would have to pass an optional environment into every vm call, which would be messy to do with external abstractions like
Function
. But it also means that external abstractions will error if an environment is not available.