I'm not sure what's the best place to record this is, so just opening an issue to point it out.
tl;drfinal local variables and static immutability are related concerns via closures
The static immutability proposal introduces objects that are deeply immutable and can be shared across isolates. Top-level and static function tear-offs should be shareable too as they have no internal shared mutable state. In fact, you can already spawn an isolate from a top-level function reference today. The static immutability provides an opportunity to expand this capability by allowing closures to be passed to other isolates along with immutable objects, perhaps as fields of those objects. In fact, a lot of Flutter widgets take closures as arguments, such as onTap. However, such closures must only close over deeply immutable final local variables.
It would make the developer experience of using shared closures more pleasant if the ergonomics of final variable was better. This is discussed in https://github.com/dart-lang/language/issues/136.
I'm not sure what's the best place to record this is, so just opening an issue to point it out.
tl;dr
final
local variables and static immutability are related concerns via closuresThe static immutability proposal introduces objects that are deeply immutable and can be shared across isolates. Top-level and static function tear-offs should be shareable too as they have no internal shared mutable state. In fact, you can already spawn an isolate from a top-level function reference today. The static immutability provides an opportunity to expand this capability by allowing closures to be passed to other isolates along with immutable objects, perhaps as fields of those objects. In fact, a lot of Flutter widgets take closures as arguments, such as
onTap
. However, such closures must only close over deeply immutablefinal
local variables.It would make the developer experience of using shared closures more pleasant if the ergonomics of
final
variable was better. This is discussed in https://github.com/dart-lang/language/issues/136.