Skip to content

add run() to platformscript interpreter#23

Merged
cowboyd merged 1 commit intomainfrom
cl/exported-run
Nov 22, 2022
Merged

add run() to platformscript interpreter#23
cowboyd merged 1 commit intomainfrom
cl/exported-run

Conversation

@cowboyd
Copy link
Copy Markdown
Member

@cowboyd cowboyd commented Nov 22, 2022

Motivation

low level environment operations such as eval, load, and call are all expressed as Effection operations, which means that we need a run function to be able to evaluate them. However, we want to make sure that the run function is scoped to the platform script interpreter because we want all operations to be halted when the interpreter is destroyed, so we can't just use raw Effection run().

Futhermore, the global objects need to be able to access this enviroment in which they are running, which gives us a chicken and the egg problem because we require the global scope to be defined before we can create the interpreter in which it will be running.

Approach

This changes the globals argument to an interpreter into a function that accepts an interpreter and returns the global arguments.

Also, to keep the interpreter clean, we remove the parse method since it doesn't really have anything to do with interpreting.

low level environment operations such as `eval`, `load`, and `call`
are all expressed as Effection operations, which means that we need a
`run` function to be able to evaluate them. However, we want to make
sure that the run function is scoped to the platform script
interpreter because we want all operations to be halted when the
interpreter is destroyed, so we can't just use raw Effection `run()`.

Futhermore, the global objects need to be able to access this
enviroment in which they are running, which gives us a chicken and the
egg problem because we require the global scope to be defined before
we can create the interpreter in which it will be running.

This changes the globals argument to an interpreter into a function
that accepts an interpreter and returns the global arguments.

Also, to keep the interpreter clean, we remove the `parse` method
since it doesn't really have anything to do with interpreting.
@cowboyd cowboyd merged commit 325f676 into main Nov 22, 2022
@cowboyd cowboyd deleted the cl/exported-run branch November 22, 2022 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants