-
Notifications
You must be signed in to change notification settings - Fork 1.7k
No way to verify that a list argument's entries are valid in a const assert #29276
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
Correct. Const expressions cannot iterate over lists or call methods. That is not new, it is a know restriction on compile-time constant expressions, and not something we expect to change. That does restrict what you can do with compile-time constant asserts, but no more than it restricts what you can do with const expressions in general. As a rule, you cannot deconstruct composite values (whether lists or other objects) at compile time, you can only build them. |
|
Revisiting this. This one assert is too useful to remove, and the fact that it's keeping |
When non-nullability comes in, will we have |
Definitely yes. |
Plugged question regarding assert in initializer list: I often wonder why they are part of the const evaluation? If they were executed only at the first initialization we could make almost every widget classes const (especially Row, Column, and Stack) without changes. |
How is that assert valuable ? If the children is a |
It's still valuable as long as we have customers running in unsound null-safety mode, and we still have a substantial number of those. |
There are other breaking changes happening all the time.
So no, it is not, it's their problem that they refuse to fix their code
but still expect things to function in any new version.
So let them be stuck on version X like in all other cases of breaking
changes.
…On Fri, 19 Nov 2021 at 01:05, Dan Field ***@***.***> wrote:
It's still valuable as long as we have customers running in unsound
null-safety mode, and we still have a substantial number of those.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#29276 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABCY4M36BWDJ43NUN26T4LUMWIERANCNFSM4DGUUDBA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I did not know they could run on unsound null safety while at the same time receive updates from flutter.. That sounds like a significant maintenance annoyance. Hopefully there are plans to drop that |
When will unsound null-safe mode be deprecated? We shouldn't restrain ourselves for so much time because some people refuses to progress... |
Don't restrain yourself. Write perfectly good null safe code, then allow that code to crash and burn if someone passes in a They had it coming. They only had themselves to blame. |
The last I checked on what data we have for this, >20% of Flutter users are using unsound null-safety. As nice as it would be to just migrate, the user experience of getting nonsensical errors at some unexpected place in your program is pretty bad. |
Isn't this one of those things that's purely theoretical? Do you have any data on how often people run into this assertion? For us, still running unsound, we've never run into it. It seems like a pretty niche thing, and for it to hold the codebase back for the majority of users is not something I agree with, even though we're not going to benefit from it atm. So pull the trigger. 🙂 |
We have data that a large number of users are still running code in unsound null-safe mode, where this assertion is helpful. Dart 3 will be removing this problem before very long. We can just wait for that. |
The text was updated successfully, but these errors were encountered: