Skip to content

Reflect: what can't be done throws "not available" rather than giving a made-up answer - #111

Merged
ASDAlexander77 merged 1 commit into
mainfrom
reflect-not-available
Nov 20, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
reflect-not-available

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Follow-up to #110. A Reflect method with no counterpart here now throws a TypeError naming it, rather than returning an answer that only looks right:

  • deleteProperty: an object's keys are fixed when it is made. It used to return false for a key that is there and true for 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) and preventExtensions (true) stay: their answers are true of tslang objects.

Tests: new reflect_not_available.ts, which needs no any keys, so it runs under every memory model. reflect_keys.ts loses its deleteProperty assertions.

Verified locally under the JIT: reflect_not_available.ts and reflect_apply.ts pass under gc, rc, none and own.

🤖 Generated with Claude Code

… 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>
@ASDAlexander77
ASDAlexander77 merged commit 3f187ef into main Nov 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant