Repository navigation
Conversation
WeakMap and WeakSet were rejected as host-only names. They are now standard globals backed by host weak collections, with the spec surface and V8 messages. Any object is a valid key. A weak collection cannot enter a run, and leaves it as undefined, like an iterator.
new Map(iterable) refused every entry that was not an array, and
read entry[0] and entry[1] off the host array directly. It now reads
both through the member model, as Object.fromEntries does, so
{ 0: key, 1: value } and Maple's own objects work as in JavaScript.
Node runs each case in the test process, so a case that replaces or deletes a built-in changes it for js-interpreter and Maple too. Every helper now runs Node last, and such a case restores the built-in in a finally before anything else runs.
A Map's or Set's size and a RegExp's source and flags are accessors on the prototype in JavaScript, not own properties. Every value still answers to them and in finds them, but Object.hasOwn and Object.getOwnPropertyNames now leave them out, and deleting one changes nothing. lastIndex stays a RegExp's one own property.
… properties As in JavaScript, a function's name and length can be deleted, which leaves what Function.prototype has, and the methods of a built-in such as Math.max can be replaced and deleted, while constants such as Math.PI and a RegExp's lastIndex cannot be deleted. An error's name, message and stack can be deleted too. What a run changes on a shared built-in stays in that run.
…uilt-in properties
Let scripts delete and replace built-in properties where JavaScript allows it
📋 Release PreviewChangelog0.6.0 (2026-10-25)🚀 Features
🩹 Bug Fixes
🧪 Tests
|
|
🎉 This PR is included in version 0.6.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.
Summary
Releases everything merged into
incrementsince 0.5.1:Highlights
WeakMapandWeakSet. Scripts can cache results per object or track visited objects.WeakMaphasget,set,hasanddelete;WeakSethasadd,hasanddelete. The constructors take an iterable and requirenew, and a primitive key throws V8'sTypeError: Invalid value used as weak map key/Invalid value used in weak set. Any object can be a key, including functions and built-ins such asMath. Both are backed by host weak collections, so entries keyed by throwaway objects can be collected during a long run. Until now reading either name threwDISALLOWED_SYNTAX.nameandlengthcan be deleted, after which they read''and0fromFunction.prototype. Built-in methods such asMath.maxorJSON.parsecan be replaced and deleted, while constants such asMath.PIstill can be neither. An error'sname,messageandstackcan be deleted, andString(e)and the error the host receives use what remains. Whatever a run replaces or deletes on a shared built-in stays in that run; nested runs and the next run see the originals.sizeand a RegExp'ssourceand flags still answer andinstill finds them, butObject.hasOwnandObject.getOwnPropertyNamesleave them out, as in JavaScript:new Map()lists[]and/a/glists['lastIndex'].new Map(iterable)accepts any object as an entry. It readsentry[0]andentry[1]likeObject.fromEntriesdoes, sonew Map([{ 0: 'a', 1: 1 }])works. Before, every entry that was not an array threw.Behaviour changes for hosts
dataor globals, or returned from a host function, it is rejected like any other unsupported value. Leaving the run it becomesundefined, and passed to a host function it throws a catchableTypeError: A WeakMap cannot be passed to the host, as an iterator does.messageornamea script deleted reaches the host with''/ the constructor's name.Math.max = fn) no longer throws.delete f.nameis no longer a no-op, anddelete r.lastIndexnow throws.Cannot delete property 'PI' of #<Object>, instead of "of a read-only object".Object.hasOwn(map, 'size')and similar checks on type accessors now returnfalse.Object.preventExtensions(Math)no longer makesObject.isSealed(Math)andObject.isFrozen(Math)reporttrue.Divergences
No new divergence from JavaScript. The parity package gained divergences where Maple follows JavaScript and js-interpreter (ES5) does not:
delete f.name, deletingMath.PIorlastIndex,Object.getOwnPropertyNameson a RegExp anddelete r.source.Tooling
finallybefore anything else runs.AGENTS.mdnotes the rule.