refactor: rename interpreter to runtime and use receiver methods #39
Reference in New Issue
Block a user
Delete Branch "refactor/runtime-and-receiver-methods"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The codebase previously used "interpreter" terminology and standalone functions for expression operations.
This PR modernizes the architecture by renaming to "runtime" and converting operations to receiver methods.
pkg/interpretertopkg/runtime.ReduceOnceto newpkg/normalorderpackage for reduction strategy isolation.Substitute,Rename,GetFree,IsFree) to receiver methods on concrete expression types.Setfrom pointer receivers to value receivers for simpler usage.Decisions
Substitute,Rename,GetFree, andIsFreeare now methods on theExpressioninterface, implemented by each concrete type (Variable,Abstraction,Application).normalorderpackage isolates the normal-order reduction strategy, allowing future reduction strategies to be added in separate packages.Setuses value receivers since Go maps are reference types and don't require pointer semantics.Benefits
expr.Substitute(target, replacement)instead ofSubstitute(expr, target, replacement).Setusage without needing to manage pointers.Checklist
<type>/<description>). Always use underscores.