summaryrefslogtreecommitdiff
path: root/internal/rpn/operations.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 12:50:29 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 12:50:29 +0300
commita5ed0193f6b100933df1d4f89b693141ce59549e (patch)
tree5646db065e4f1216a64c9afff13d39e2673d24a3 /internal/rpn/operations.go
parentd887209a86da6cfe5d3d34b638a34f769f15ac5f (diff)
rpn: remove combined Operator interface per ISP
The Operator interface (~40 methods) embedded 7 sub-interfaces plus mode/prefix/metric/custom methods. Since RPN is the sole client and *Operations is the sole implementor, the combined interface added indirection without practical benefit. Changes: - Remove type Operator entirely - RPN.ops: Operator -> *Operations (concrete type) - NewOperatorRegistry: Operator -> *Operations - Compile-time checks: one per sub-interface (7 checks) - Sub-interfaces preserved for documentation/organization
Diffstat (limited to 'internal/rpn/operations.go')
-rw-r--r--internal/rpn/operations.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/internal/rpn/operations.go b/internal/rpn/operations.go
index 99b8e6b..3dfc7c2 100644
--- a/internal/rpn/operations.go
+++ b/internal/rpn/operations.go
@@ -17,10 +17,16 @@ type Operations struct {
mu sync.RWMutex
}
-// Ensure Operations implements Operator at compile time.
-// This is an explicit interface satisfaction check that will fail to compile
-// if Operations doesn't implement all methods required by the Operator interface.
-var _ Operator = (*Operations)(nil)
+// Ensure Operations implements all operator sub-interfaces at compile time.
+var (
+ _ ArithmeticOperator = (*Operations)(nil)
+ _ BooleanOperator = (*Operations)(nil)
+ _ HyperOperator = (*Operations)(nil)
+ _ StackOperator = (*Operations)(nil)
+ _ VariableOperator = (*Operations)(nil)
+ _ ConstantOperator = (*Operations)(nil)
+ _ PowerIntOperator = (*Operations)(nil)
+)
// NewOperations creates a new Operations instance with the given variable store.
// Creates a new ConstantsProvider internally; use SetConstants to replace it.