The `final` keyword is too long
It's inconvenient that declaring final variables require more typing than non-final variables. This discourages the use of final variables. Even with inferred types, it's shorter, and if you want to specify the type, it gets even longer: ```dart var foo = ...; String foo = ...; final foo = ...; final String foo = ...; ``` While final variables are not strictly necessary (if you don't assign to a variable, it doesn't matter semantically whether it's declared final or not), some people prefer a style where you make variables final unless they need to be mutable, and Dart does not support that writing style very well. See #135 for one suggestion which improves the experience for inferred variables by replacing `final` with `val`. It doesn't improve the typed case. It requires adding a new built-in identifier (but likely not a reserved word). Another option could be using `:=` for final initialization (since final local variables need to be initialized): ```dart: foo := ...; String foo := ...; ``` This doesn't work for instance variables since they may be intialized by a constructor, or parameters, and to keep requiring the `final` word for instance variables and parameters, and using `:=` everywhere else, is inconsistent.
Posted by lrhn on Dec 17, 2018, 9:28 AM
Tags
Related issues
- some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
- I think of this as the kiosk economy.
- What a goofy comment.
- There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
- Compose support in WSLc
- [RFC] Roadmap to v2.0
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
support (Other)
some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
I think of this as the kiosk economy.
What a goofy comment.
There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
Compose support in WSLc
[RFC] Roadmap to v2.0
[Feature]: Add TurboQuant Support for KV Cache Quantization
Support for AGENTS.md and .agents/skills/, the community has been asking since August 2025
The `final` keyword is too long
It's inconvenient that declaring final variables require more typing than non-final variables. This discourages the use of final variables. Even with inferred types, it's shorter, and if you want to specify the type, it gets even longer: ```dart var foo = ...; String foo = ...; final foo = ...; final String foo = ...; ``` While final variables are not strictly necessary (if you don't assign to a variable, it doesn't matter semantically whether it's declared final or not), some people prefer a style where you make variables final unless they need to be mutable, and Dart does not support that writing style very well. See #135 for one suggestion which improves the experience for inferred variables by replacing `final` with `val`. It doesn't improve the typed case. It requires adding a new built-in identifier (but likely not a reserved word). Another option could be using `:=` for final initialization (since final local variables need to be initialized): ```dart: foo := ...; String foo := ...; ``` This doesn't work for instance variables since they may be intialized by a constructor, or parameters, and to keep requiring the `final` word for instance variables and parameters, and using `:=` everywhere else, is inconsistent.
Comments (0)
No comments yet. Start the discussion.