From 77c21d86ea4c9b8621af1dcbd64acec7b65706a3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 20 Mar 2026 22:09:19 +0200 Subject: refactor: update Operations to use VariableStore interface - Changed Operations.vars from *Variables to VariableStore interface - Changed NewOperations to accept VariableStore interface - Changed RPN.vars from *Variables to VariableStore interface - Changed NewRPN to accept VariableStore interface - Removed type assertions in main.go and repl.go - Added FormatVariables to VariableStore interface - All tests pass, build successful --- internal/repl/repl.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/repl') diff --git a/internal/repl/repl.go b/internal/repl/repl.go index c5a87b1..f79f92f 100644 --- a/internal/repl/repl.go +++ b/internal/repl/repl.go @@ -20,7 +20,7 @@ const historyFile = ".perc_history" // RPNState holds the state for RPN operations in REPL type RPNState struct { - vars *rpn.Variables + vars rpn.VariableStore rpnCalc *rpn.RPN } @@ -29,7 +29,7 @@ var rpnState *RPNState // getRPNState returns or creates the RPN state func getRPNState() *RPNState { if rpnState == nil { - vars := rpn.NewVariables().(*rpn.Variables) + vars := rpn.NewVariables() rpnState = &RPNState{ vars: vars, rpnCalc: rpn.NewRPN(vars), @@ -109,7 +109,7 @@ func executor(input string) { // runRPN parses and evaluates an RPN expression func runRPN(input string) (string, error) { - vars := rpn.NewVariables().(*rpn.Variables) + vars := rpn.NewVariables() rpnCalc := rpn.NewRPN(vars) return rpnCalc.ParseAndEvaluate(input) } -- cgit v1.2.3