Commit 8e8e121
Complete Phase 5B: operator overloading, dunder protocols, decorators
Add dunder method dispatch for user-defined classes, enabling Python-like
operator overloading and special method protocols needed for leanSpec's
BaseUint/Fp classes. Key additions:
- Binary/unary/comparison operator overloading via __add__, __sub__, __mul__,
__eq__, __lt__, __neg__, etc. with reflected operator fallback (__radd__, etc.)
- Special methods: __str__, __repr__, __len__, __hash__, __bool__, __call__,
__contains__, __getitem__, __setitem__, __delitem__
- Decorator evaluation: @staticmethod, @classmethod, @Property (with .setter),
and generic decorators
- New Value types: staticMethod, classMethod, property with descriptor-like
attribute access semantics
- 25 new passing tests (182 total)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 8541acb commit 8e8e121
6 files changed
Lines changed: 485 additions & 15 deletions
File tree
- LeanPythonTest
- LeanPython
- Interpreter
- Runtime
0 commit comments