diff options
| author | Antonio Navarro Perez <antnavper@gmail.com> | 2024-03-21 15:46:33 +0100 |
|---|---|---|
| committer | Antonio Navarro Perez <antnavper@gmail.com> | 2024-03-21 15:46:33 +0100 |
| commit | 7a9ac73037f207e3895332e5ba2b30d465c9c339 (patch) | |
| tree | 041f819cdeae47e3ed624dc2ce233cd2c1d143aa | |
| parent | 649ae829220d6ddd8758d24c3bc2ea7d43e788d6 (diff) | |
Add extra GoDoc to explain why Dump is on the Compiler.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
| -rw-r--r-- | parser/compiler.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/parser/compiler.go b/parser/compiler.go index 568ed4a..fb79720 100644 --- a/parser/compiler.go +++ b/parser/compiler.go @@ -377,7 +377,13 @@ type DumpValue struct { Value any } -// Dump gets the execution state of global variables. +// Dump creates a snapshot of the execution state of global variables. +// This method is specifically implemented in the Compiler to minimize the coupling between +// the dump format and other components. By situating the dump logic in the Compiler, +// it relies solely on the program being executed and the indexing algorithm used for ordering variables +// (currently, this is an integer that corresponds to the order of variables in the program). +// This design choice allows the Virtual Machine (VM) to evolve its memory management strategies +// without compromising backward compatibility with dumps generated by previous versions. func (c *Compiler) Dump() *Dump { var dv []*DumpValue dict := c.symbolsByIndex() |
