Repository navigation
Conversation
A function that is not an arrow gets strict-mode this: the object of a method call, undefined for a plain call, and the receiver call, apply and bind pass, never boxed. An arrow sees the this of the function it is written in. At the top level this is undefined, since there is no global object. Host functions and intrinsics still receive no this. Constructors and prototypes stay unsupported.
every, filter, find, findIndex, findLast, findLastIndex, flatMap, forEach, map, some, Array.from and the forEach of Map and Set call their callback with the thisArg as this. Every other built-in callback keeps undefined.
A reviver no longer receives the holder as a third argument; it is this instead, as in JavaScript. Use this where a reviver read the third argument.
A function replacer is called with the object holding the key as this, and with a fresh object around the value at the top level, as in JavaScript.
馃搵 Release PreviewChangelog0.4.0 (2026-10-20)馃殌 Features
馃摉 Documentation
|
There was a problem hiding this comment.
馃數 Needs a closer look
The broad evaluator, builtin, sandbox, and parity changes warrant final human review.
No open issues 馃帀
What changed in this PR
Adds strict-mode this support for Maple script functions, callbacks, and JSON hooks while preserving sandbox isolation.
Changes:
- Tracks receivers through scopes, methods, arrows, and function calls.
- Adds
thisArgsupport across array, Map, and Set callbacks. - Updates JSON behavior, parity coverage, documentation, and contributor guidance.
| File | Summary |
|---|---|
packages/鈥媘aple/鈥媠rc/鈥媏valuator/鈥媠cope.ts |
Tracks lexical receivers. |
packages/鈥媘aple/鈥媠rc/鈥媏valuator/鈥媠cope.spec.ts |
Tests receiver scope behavior. |
packages/鈥媘aple/鈥媠rc/鈥媏valuator/鈥媐unctions.spec.ts |
Tests function receiver semantics. |
packages/鈥媘aple/鈥媠rc/鈥媏valuator/鈥媏valuator.ts |
Propagates receivers during evaluation and calls. |
packages/鈥媘aple/鈥媠rc/鈥媏scapes.spec.ts |
Tests receiver sandbox isolation. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媠et/鈥媠et.spec.ts |
Tests Set callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媠et/鈥媘ethods/鈥媐or-each.ts |
Supports Set thisArg. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媘ap/鈥媘ethods/鈥媐or-each.ts |
Supports Map thisArg. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媘ap/鈥媘ap.spec.ts |
Tests Map callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媕son/鈥媠tatics/鈥媠tringify.ts |
Supplies replacer holders as this. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媕son/鈥媠tatics/鈥媝arse.ts |
Supplies reviver holders as this. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媕son/鈥媕son.spec.ts |
Tests JSON receiver behavior. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媢tils/鈥媋rray-callback.ts |
Supports callback receiver handling. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媠tatics/鈥媐rom.ts |
Supports Array.from thisArg. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媠ome.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媘ap.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媐or-each.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媐lat-map.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媐ind.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媐ind-last.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媐ind-last-index.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媐ind-index.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媐ilter.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媘ethods/鈥媏very.ts |
Passes array callback receivers. |
packages/鈥媘aple/鈥媠rc/鈥媌uiltins/鈥媋rray/鈥媋rray.spec.ts |
Tests array callback receivers. |
packages/鈥媘aple/鈥媎ocs/鈥媠ecurity.md |
Documents receiver isolation. |
packages/鈥媘aple/鈥媎ocs/鈥媗anguage.md |
Documents script-function this. |
packages/鈥媘aple/鈥媎ocs/鈥媏xtending.md |
Documents host and intrinsic receiver behavior. |
packages/鈥媘aple/鈥媎ocs/鈥媎ivergences.md |
Updates documented divergences. |
packages/鈥媘aple/鈥媎ocs/鈥媌uiltins.md |
Documents callback thisArg support. |
packages/鈥媘aple-parity/鈥媠rc/鈥媎ivergences.spec.ts |
Tests intentional engine divergences. |
packages/鈥媘aple-parity/鈥媠rc/鈥媍ases/鈥媐unctions.spec.ts |
Adds parity coverage for this. |
packages/鈥媘aple-parity/鈥婻EADME.md |
Updates parity documentation. |
CONTRIBUTING.md |
Updates commit-scope guidance. |
AGENTS.md |
Updates repository conventions. |
Review effort: Lite
|
馃帀 This PR is included in version 0.4.0 馃帀 The release is available on: Your semantic-release bot 馃摝馃殌 |
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.
Script functions get JavaScript's strict-mode
this. Constructors and prototypes stay unsupported.What changed
thisis the object of a method call,undefinedfor a plain call and at the top level, and whatevercall,applyandbindpass. Arrows take it from the enclosing function.Array.fromand theforEachof Map and Set take athisArg.this. A reviver no longer receives the holder as a third argument.