Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jcouv
Copy link
Member

@jcouv jcouv commented Jan 21, 2025

For enumerables, the problem was introduced recently.
For async-enumerables, the problem existed from the beginning.

Old

  • Iterator: N <= -3 (finalize states), -2 (initial for enumerable, finished), -1 (running), 0 (initial for enumerator, ie. start of method), N > 0 (resumable states for 'yield return')
  • Async-iterator: N <= -4 (resumable states for yield return) -3 (initial for enumerator) -2 (initial for enumerable, finished) -1 (running) N >= 0 (resumable states for await)
  • Async: N <= -3 (vestigial finalizer states in VB) -2 (finished) -1 (running) N >= 0 (resumable states for await)

Goal

Separate the finished and initial states

Changes

  • Async-iterator initial state (ie. indicating start of method) is now -4
  • Iterator and async-iterator finish on -3
  • No changes to async

New

  • Iterator: N <= -4 (finalize states), -3 (finished), -2 (initial for enumerable), -1 (running), 0 (initial for enumerator, ie. start of method), N > 0 (resumable states for 'yield return')
  • Async-iterator: N <= -5 (resumable states for yield return) -4 (initial for enumerator) -3 (finished) -2 (initial for enumerable) -1 (running) N >= 0 (resumable states for await)

Questions

  • I debated changing the finished state for async machines too (from -2 to -3). That would create some alignment across state machine kinds.

@jcouv jcouv self-assigned this Jan 21, 2025
@ghost ghost added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant