feat: {{}} compound assignments and polyglot support#95
Merged
benbernard merged 2 commits intomasterfrom Feb 24, 2026
Merged
Conversation
- Add compound assignment regex to transformCode() (+=, -=, *=, etc.)
so {{field}} += val expands to __set(r, "field", __get(r, "field") + val)
- Add recordVar parameter to transformCode() for language-specific
variable names ("r" for JS/Python, "$r" for Perl)
- Apply transformCode() in Python/Perl snippet runners so {{}} templates
work across all three languages
- Add __get/__set helpers to Python runner.py and Perl runner.pl
- Add cross-language TemplateExpansion test suite verifying identical
behavior for reads, writes, compound assigns, and nested keys
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Performance Benchmark Results
103 benchmarks: 15 faster, 16 slower, 72 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
{{field}} += valcompound assignments in JS (previously produced invalid code like__get(r, "field") += val){{}}template expansion to Python and Perl snippet runners, so the same{{field}}syntax works across all three languages__get/__sethelpers to Pythonrunner.pyand Perlrunner.plrecordVarparameter totransformCode()to support Perl's$rvariableTest plan
bun test tests/Executor.test.ts— 43 tests including 25 new compound/recordVar testsbun test tests/snippets/TemplateExpansion.test.ts— 36 cross-language tests (12 cases × 3 languages)bun test— full suite passes (1595 pass, 0 fail)echo '{"x":5}' | recs eval '{{x}} += 10'→{"x":15}(JS, Python, Perl)🤖 Generated with Claude Code