From d106b9ac10c67a7e1c98dbb626e17c22b70048ec Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 23 May 2026 23:54:33 +0300 Subject: 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. --- internal/rpn/constants.go | 9 ++++----- 1 file 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() -- cgit v1.2.3