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 PR fixes some minor things I encountered when working on Scheme stuff.
When we started leaving signatures around longer, I missed a case in the lambda lifting that caused us to float lambdas out of signatures. So if you had:
it would turn into something like:
which is silly.
Serialization for binders was wrong. Variables are serialized as de Bruijn indices, so the serializer threads a backwards context around. But multi-variable bindings were pushing the variables on in the forwards order. I think it was technically broken in both directions, which might have made the serializer actually work. But it's better if the indices are numbered the standard way, because it allows simple arithmetic for certain things, rather than having to keep track of a list to figure out the weird permutations in certain cases.
I guess I could revert this change if we want to not declare that the format was broken, since it might have been technically working (although I'm unsure about that, too). But it'd be nicer to just switch to the intended format.
I extended the format to enable serializing builtins that are implemented with foreign ops. This doesn't make sense to use for sending code to a remote machine, since they might not have the foreign operation, but it's useful for getting access to the builtins via binary until I figure out an API that doesn't go through the serializer.
I allowed the
Code
lookup function to look up builtins. This is again useful for a compiler, and not very useful for remote evaluation (since the remote should already have any builtins if we want it to work properly).