dart-lang / dart-lang/language
Specify that writes in `late` local variable initializers disable promotion
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
`late` local variables with initializers are evaluated lazily. This means that writes in the initializer may be evaluated anywhere the variable is referenced. We should probably treat this like a write in a closure. In principle this is more analyzable: we could treat the writes as happening at every reference to the variable, but it's not clear that this is worth the extra mechanism.
cc @johnniwinther @stereotype441
Contributor guide
Research direction
Read the issue description and the Dart language specification rules for late local variable initializers, writes, closures, and promotion. Resolve whether initializer writes disable promotion and whether treating them as occurring at every variable reference is warranted, then specify the chosen behavior clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100