Skip to content

Conversation

legendecas
Copy link
Member

The [[AsyncContextMapping]] is never going to be a WeakMap equivalent storage, providing operations like delete, get, has, or set. It is only intended to say that the value in an Async Context Mapping Record is only necessarily live when its corresponding key is live.

Fixes: #76

@legendecas legendecas force-pushed the liveness branch 2 times, most recently from 65586c9 to 349f5fb Compare September 9, 2025 12:37

<emu-note>
<p>The value field [[AsyncContextValue]] in the list [[AsyncContextMapping]] of an Agent Record is only intended to be accessed via an [[AsyncContextKey]] field. The list is not iterable through AsyncContext APIs.</p>
<p>The above definition implies that, if a value in the [[AsyncContextKey]] field in an Async Context Mapping Record is not live, then its corresponding value of [[AsyncContextValue]] is not necessarily live either.</p>
Copy link
Member

@andreubotella andreubotella Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the semantics here could be better expressed in two steps:

  • A live [[AsyncContextMapping]] does not necessarily keep its [[AsyncContextKey]]s alive
  • For a live [[AsyncContextMapping]], if an [[AsyncContextKey]] is not live, its corresponding [[AsyncContextValue]] is not necessarily kept alive.

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.

Should the AsyncContext store be a weak map?
2 participants