Skip to content
This repository was archived by the owner on Jun 11, 2026. It is now read-only.
This repository was archived by the owner on Jun 11, 2026. It is now read-only.

Support forward-referencing (or late-bound references) from closures #476

Description

@sam-goodwin

Keywords

late-bound, hoisted, forward reference

Description

Our interpreters eagerly evaluate closures which has the unfortunate consequence of not allowing closures such as those in a StepFunction or Function to call an Integration defined after it.

new Function(scope, id, async () => {
  // error: queue is not defined
  await queue.sendMessage({ .. });
});

const queue = new Queue(scope, id);

Instead, evaluation should happen during synthesis and after the initial Construct tree is built.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions