This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(api fix:1801 new:1801)
'vm'
module uses sandbox as prototype
God, I hate the ~50-character limit on commit messages. Almost impossible to fit useful info in there. Anyway. As described in GH-1801, the `'vm'` module was handling the `sandbox` object provided by the API consumer in a particularly terrible and fragile fashion: it was simply shallow-copying any enumerable properties from the sandbox onto the global context before executing the code, and then eventually copying any values on the global context back into the sandbox object *afterwards*. This commit removes all of that implementation, and utilizes the passed sandbox object as the *prototype of the context* instead. A bit of a hack, but a very effective one. This no longer allows for new variables created in the global context to be placed into your sandbox after execution has completed, but that’s for the best anyway, as it’s not very in line with the concept of a “box of passed-in context.” I’m planning to further implement an interface for API consumers to acquire the *actual global* from within the VM soon, thus allowing for separation-of-concerns: providing data *to* the VM via the sandbox-prototype, and exploring the internal environment of the VM itself. // GitHub cruft: closes #1801 Squashes: 2c1f5206bb..2ab8ab1292
- Loading branch information
1 parent
9fa7480
commit 43b8e3c
Showing
3 changed files
with
56 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters