magicblock-labs / magicblock-labs/bolt

[Feature] Change execute signature

Open
#132 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
64
Forks
18
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
What if we could express this
```rust
#[system]
pub mod game_loop {
pub fn execute(ctx: Context, delta_time: f32) -> Result {
Ok(ctx.accounts)
}

#[system_input]
pub struct Components {
pub game_state: GameState,
}
}
```
as
```rust
#[system]
impl System for GameLoop {
fn execute(&self, game_state: &mut GameState, delta_time: f32) -> Result<()> {
let in_case_we_need_to_access_context = self.context();
Ok(())
}
}
```

This would make the code more Rusty and we could also benefit from having the ability to define mutability.

Important note:

`Components` are always borrowed
System `Arguments` are always moved

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing #[system] and #[system_input] handling described in the issue. Define how impl System with execute arguments should support borrowed Components, mutable references, moved arguments, and context access; the change is done when the proposed GameLoop form can express those semantics consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.