Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New architecture #125

Open
liquidev opened this issue Oct 31, 2022 · 0 comments
Open

New architecture #125

liquidev opened this issue Oct 31, 2022 · 0 comments
Labels
mod: hl refactoring A crate needs to be refactored. This label must be accompanied by a `crate: *` label

Comments

@liquidev
Copy link
Member

aka. decoupling stuff into smaller parts.

The plan is to split the monolithic Engine into many smaller components:

  • There'll be a new Engine that only contains an Environment. It will be used for compiling Scripts.
    • Scripts will no longer hold a mutable reference to the engine, and instead will use a unique ID assigned to the engine at its creation to ensure correctness.
  • Engines will also be used for creating Isolates, which will be the actual execution environments.
    • An Isolate is like a reusable replacement for a Fiber, except as the name suggests - it's completely isolated from other isolates. Each isolate has its own GC and global storage.
      • Scripts will no longer be able to write global variables, only read from them. Global variable shadowing will also not be allowed.
        • I'm also considering making global variables be part of the Engine, because hey they're immutable anyways. But we'll see how that goes.
  • In addition there will also be a Registry type - a dynamically typed storage container, basically a HashMap<TypeId, RefCell<Box<dyn Any>>>.
    • There will be two registries: the static registry (part of the Engine,) and the isolate registry (one per Isolate). Foreign functions will have a way of accessing these registries and mutating what's inside them.
    • This mechanism will be modeled to fit the requirements for implementing require.
@liquidev liquidev added refactoring A crate needs to be refactored. This label must be accompanied by a `crate: *` label mod: hl labels Oct 31, 2022
@liquidev liquidev added this to the 0.9.0 milestone Oct 31, 2022
@liquidev liquidev removed this from the 0.9.0 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: hl refactoring A crate needs to be refactored. This label must be accompanied by a `crate: *` label
Projects
None yet
Development

No branches or pull requests

1 participant