Stable getters
# Stable Getters Promotion of fields is probably the most prominent request we have in response to the release of null safety. One approach to improve support for promotion could be to ensure that a particular getter will return the same value if invoked multiple times, that is, the getter is _stable_. Note that the underlying concept is _immutability_: A stable getter will implement an immutable property of the given object (if it's an instance getter, otherwise it's just an immutable property). This is a concept which is useful both because it enables promotion, but also for a number of other reasons related to software correctness and readability. ```dart abstract class A { stable num get n; } class B1 implements A { final num n; // OK. B(this.n); } class B2 implements A { late final int n = aComplexExpression; // OK. } class B3 implements A { num get n => someExpression; // Error, unless `someExpression` is stable. } ``` The modifier `stable` can be specified on any final instance variable or instance getter declaration. When `stable` is present in a declaration where the syntax also admits `final`, `final` is implied and may be omitted. A compile-time error occurs if an instance getter declaration directly or indirectly overrides another getter declaration, where each of them can be explicitly declared or implicitly induced by a variable declaration, when the overridden declaration is marked `stable` and the overriding declaration is not a stable decla
Posted by eernstg on Mar 13, 2021, 11:40 AM
Tags
Related issues
- I hate that this whole cluster of beliefs exists, but software on my own computer enforcing what I can and can't do for ideological reaso...
- As I replied in another comment[1], it's their software, their choice.
- [Feature] Support external model integration via personal API keys and local LLMs (BYOK)
- > So when head of companies don’t care about quality, they’ll push hard no matter what to have speed.
- Feature request: support multiple named accounts per app/connector
- Support standalone Windows installer (`codex-setup.exe`)
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
support (SaaS)
I hate that this whole cluster of beliefs exists, but software on my own computer enforcing what I can and can't do for ideological reaso...
NewAs I replied in another comment[1], it's their software, their choice.
[Feature] Support external model integration via personal API keys and local LLMs (BYOK)
> So when head of companies don’t care about quality, they’ll push hard no matter what to have speed.
Feature request: support multiple named accounts per app/connector
Support standalone Windows installer (`codex-setup.exe`)
[feature]: Move OIDC back to self-hosted OSS(Plane Free)
I was running about 1000 machines on VMware in my previous career.
Stable getters
# Stable Getters Promotion of fields is probably the most prominent request we have in response to the release of null safety. One approach to improve support for promotion could be to ensure that a particular getter will return the same value if invoked multiple times, that is, the getter is _stable_. Note that the underlying concept is _immutability_: A stable getter will implement an immutable property of the given object (if it's an instance getter, otherwise it's just an immutable property). This is a concept which is useful both because it enables promotion, but also for a number of other reasons related to software correctness and readability. ```dart abstract class A { stable num get n; } class B1 implements A { final num n; // OK. B(this.n); } class B2 implements A { late final int n = aComplexExpression; // OK. } class B3 implements A { num get n => someExpression; // Error, unless `someExpression` is stable. } ``` The modifier `stable` can be specified on any final instance variable or instance getter declaration. When `stable` is present in a declaration where the syntax also admits `final`, `final` is implied and may be omitted. A compile-time error occurs if an instance getter declaration directly or indirectly overrides another getter declaration, where each of them can be explicitly declared or implicitly induced by a variable declaration, when the overridden declaration is marked `stable` and the overriding declaration is not a stable decla
Comments (0)
No comments yet. Start the discussion.