Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

108 lines (84 sloc) 3.596 kb
Start with a full running program
| Original Program |
----->
Calls tick
Calls load_module
Calls run_module
Intercepts arbitrary calls
| Circa data structures |
| Branches & Terms |
| Native functions |
| Owns top-level state |
<-----
Modified stored code
Saves code to text files
| Has existing modules |
| Draws everything |
"CodeLab" mode
Can add help scripts to any arbitrary program
All we need is the ability to draw our UI
Communication can be remote
Things we definitely need:
Branch & Term data structure
Add code generator, Branch -> Lua
In the generated code, funcs have the ability to pause the interpreter, and
to provide reflection to the caller.
Change tracking
Top-level code for managing modules, files, state
Things we may not need:
Evaluation/interpreter
How much metadata does the Stack need?
--
Components
Code generator
Take a Branch and Hints as input, spit out source text as output
Source text may contain references to original code
These references should use unique names (not pointers)
Module
Has a filename
Has a Branch
Has a list of native overrides
World
Has a list of loaded modules
Has a list of recent change events
Has a link to foreign interpreter
Stores a cache of (Branch,Hints) -> ForeignFunctionIdentifier
Has a list of active hint requests
When a hint changes, we need to regenerate that foreign function
Has the ability to run a module
A pointer to the world is provided to the foreign interpreter, for reflection
--
Expected user workflow
Load all scripts at startup
Start running
Press a key to activate circa UI
Browse circa UI
While browsing, UI should provide hints about current execution
These hints will be harvested from code that is generated with extra reflection
We should make sure it's efficient to change the generation hints frequently
User may trigger a code modification event
This will trigger a change to Branches, which should trigger a lua regenerate
Code change events need to be tracked by the master
Don't want master to constantly re-check the version of every function
Load all scripts, start running
Use the UI to indicate that we are interested in a certain event. Or maybe, all events.
This is stored on the World
Event occurs, triggers our reflective handler
Event handling is now paused
UI displays information about the incoming event
User can reshape the handler
When done, user can allow the event to continue as normal?
What happens at the site of a code change?
We could interrupt the current program
Additionally we could save the program's inputs for next evaluation
We could partial interrupt - just finish the function in question, but continue
with other top-level code
Keep interrupting until a result value is not needed?
This is like "abandoning a dataflow chain".
We could generate a continuation - code that represents the remaining bits of
the function in question, and then run that.
We could pause the interpreter
Open question: Need to support interpreter save & restore?
Very powerful operation, but also fairly difficult
May be too powerful for our needs
We have ability to save & restore state which gives us some of the same features
Jump to Line
Something went wrong with that request. Please try again.