Repository navigation
Reflect: what can't be done throws "not available" rather than giving a made-up answer - #111
Merged
Merged
Conversation
… a made-up answer deleteProperty throws a TypeError (an object's keys are fixed when it is made), and so do defineProperty, getOwnPropertyDescriptor, getPrototypeOf and setPrototypeOf (no property descriptors, no prototypes), which were left out before: a program now compiles and learns at run time that the method is not available. Tested by reflect_not_available.ts under every memory model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #110. A Reflect method with no counterpart here now throws a
TypeErrornaming it, rather than returning an answer that only looks right:deleteProperty: an object's keys are fixed when it is made. It used to returnfalsefor a key that is there andtruefor one that isn't.defineProperty,getOwnPropertyDescriptor: there are no property descriptors.getPrototypeOf,setPrototypeOf: there are no prototypes.The last four were left out before, so calling them was a compile error. Now the program compiles and finds out at run time, e.g.
Reflect.deleteProperty is not available: an object's keys are fixed when it is made.isExtensible(false) andpreventExtensions(true) stay: their answers are true of tslang objects.Tests: new
reflect_not_available.ts, which needs noanykeys, so it runs under every memory model.reflect_keys.tsloses itsdeletePropertyassertions.Verified locally under the JIT:
reflect_not_available.tsandreflect_apply.tspass under gc, rc, none and own.🤖 Generated with Claude Code