summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-23 23:54:33 +0300
committerPaul Buetow <paul@buetow.org>2026-05-23 23:54:33 +0300
commitd106b9ac10c67a7e1c98dbb626e17c22b70048ec (patch)
tree7074d6ae142746436c9138da24bfa776275ad34a
parentcd6e99821d663b87113cd4da837c1f9a250adf66 (diff)
docs(rpn): fix misleading comments on ClearConstants and ReloadBuiltInConstants
- ClearConstants was documented as preserving built-ins, but it clears everything and reloads defaults. - ReloadBuiltInConstants was documented as being called by ClearConstants, but ClearConstants calls loadBuiltInConstants directly. ReloadBuiltInConstants actually removes user-defined constants and resets built-ins to defaults.
-rw-r--r--internal/rpn/constants.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/internal/rpn/constants.go b/internal/rpn/constants.go
index 5489866..18d9ff3 100644
--- a/internal/rpn/constants.go
+++ b/internal/rpn/constants.go
@@ -143,8 +143,8 @@ func (c *Constants) ListConstants() []ConstantInfo {
return infos
}
-// ClearConstants removes all constants from storage.
-// Note: This clears only user-defined constants; built-in constants are preserved.
+// ClearConstants removes all constants and reloads the built-in defaults.
+// Note: This resets all constants, including any user-defined ones.
func (c *Constants) ClearConstants() {
c.mu.Lock()
defer c.mu.Unlock()
@@ -153,9 +153,8 @@ func (c *Constants) ClearConstants() {
c.loadBuiltInConstants()
}
-// ReloadBuiltInConstants restores all built-in constants.
-// This is called internally when ClearConstants is used to ensure
-// built-in constants are preserved.
+// ReloadBuiltInConstants restores all built-in constants to their default values.
+// It also removes any user-defined constants, effectively resetting the store.
func (c *Constants) ReloadBuiltInConstants() {
c.mu.Lock()
defer c.mu.Unlock()