-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dart 2.0 lib changes / constants lower case #31245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is the convention since at least 3 years and used consequently since then as far as I know. What's the value of having a different style for constants? Uppercase is cumbersome to write and to read. |
This is indeed done entirely to follow the Dart style guide. All future Dart code will use lowerCamelCase for constants, so we take this one opportunity to get the platform libraries into line. It is a breaking change, so we need to do it as soon as possible. |
What is first code or style guide? pi in lowercase - what a ... A style guide should define best practice and not it's own universe!!!! @zoechi Sure it's true that uppercase is a bit harder to write but code should be documentation. Uppercase tells everyone that this is not a var but a const value. Without this convention we loose part of our documentation. BTW Google is not always right with their styleguides - C++ for example is very Google centric and in many cases outdated. |
The style guide states that constants have to be lowerCase. This choice is definitely not uncontroversial, but the choice of how constants should be written was done a long time ago, and is unlikely to change now. The Dart libraries are simply following the guide now, which makes code look more consistent. |
@MikeMitterer the difference between Therefore such a strong differentiation with UPPERCASE doesn't carry its weight in Dart. We could introduce MiXeDcAsE for final fields ;p |
Just found this in Kotlin style guide for Android: Constant namesConstant names use UPPER_SNAKE_CASE: all uppercase letters, with words separated by underscores. But what is a constant, exactly? Constants are val properties with no custom get function, whose contents are deeply immutable, and whose functions have no detectable side-effects. This includes immutable types and immutable collections of immutable types as well as scalars and string if marked as const. @zoechi First of all - is it really "We"? Second it's not necessary to tell me how to write var/const/final names! |
Related: #58508 |
Why????
The whole world uses UPPERCASE for constants why do you plan to break this convention?
The text was updated successfully, but these errors were encountered: