Refactor VM to use trait objects for closures
The `CallFrame` struct and various VM methods now use `Rc<dyn Object>` to hold closures, allowing for more flexibility and avoiding unnecessary cloning. This change also addresses the performance concern regarding deep copies of closures, preferring `Rc<dyn Trait>` with local `downcast_ref` where appropriate. Additionally, a documentation note has been added to `gemini.md` regarding this performance preference in Rust.
This commit is contained in:
@@ -33,6 +33,10 @@ Wichtig: zentraler Einstiegspunkt ist Delphi/Myc.Ast.Environment.pasund die dort
|
||||
* Dokumentation nach Rust-Regeln.
|
||||
* Im Code und den Kommentaren muss alles auf englisch sein.
|
||||
|
||||
## Rust
|
||||
|
||||
* Performance: Bevorzuge `Rc<dyn Trait>` + lokales `downcast_ref` gegenüber Deep Copies via `Rc::new(obj.clone())`.
|
||||
|
||||
## Interaktion
|
||||
|
||||
* Ich kann Rust noch nicht so gut. Erkläre mir, was du machst und welche Konzepte du nutzt. Ich will was dazulernen.
|
||||
|
||||
Reference in New Issue
Block a user