Skip to content

[Feature] Implement stack context-aware compiler inspection and dynamic type narrowing #728

@Luna-Klatzer

Description

@Luna-Klatzer

Is there an existing proposal for this?

  • I have searched the existing issues

This feature does not exist in the latest version

  • I am using the latest version

Proposal

This issue proposes the implementation of context-aware compiler inspection, which includes dynamic type narrowing, to allow the user to perform certain actions that logically conclude certain type constraints and circumstances. This would entail adding local symbol tables that keep track of these type narrowing and logical assertions, such as if (typeof x == num) { // in this scope 'x' is of type 'num' }.

Exact behaviour / changes you want

  • Add a local symbol table which keeps track of all type narrowing operations and allow the user to work based on these specific types.
  • Implement an internal API which does not directly reference variable types but rely on the local symbol table first before falling back to the "global" type.

Metadata

Metadata

Assignees

Labels

breaking changeThis is a breaking changefeatureNew feature or enhancementhigh priorityHigh priority issue, discussion or pull request

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions