Replace regex-based {{}} expansion with lvalue/Proxy approach#97
Merged
benbernard merged 1 commit intomasterfrom Feb 25, 2026
Merged
Replace regex-based {{}} expansion with lvalue/Proxy approach#97benbernard merged 1 commit intomasterfrom
benbernard merged 1 commit intomasterfrom
Conversation
Replace the fragile 3-step regex pipeline in transformCode() with a
single regex that produces language-native lvalue expressions. The
language itself now handles reads, writes, compound assignments, and
increment/decrement — no assignment-detection regex needed.
- JS: {{x}} → __F["x"] via Proxy get/set traps
- Python: {{x}} → __F["x"] via __getitem__/__setitem__
- Perl: {{x}} → _f("x") via lvalue sub returning hash element
Fixes bugs where the old [^;,\n]+ RHS capture regex broke on commas
in function calls, array literals, object literals, and ternaries.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Performance Benchmark Results
103 benchmarks: 15 faster, 14 slower, 74 within noise (10%)
Full benchmark resultsJSON Parsing
JSON Serialization
KeySpec Access
Core Operations
Pipeline Overhead
Record Creation & Serialization
Chain vs Pipe
Line Reading
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
transformCode()with a single{{(.*?)}}regex{{x}}to__F["x"]backed by a Proxy with get/set traps{{x}}to__F["x"]backed by__getitem__/__setitem__{{x}}to_f("x")using a lvalue sub that returns the hash element directly[^;,\n]+RHS capture broke on commas in function calls, array/object literals, and ternaries++/--supportTest plan
++/--🤖 Generated with Claude Code