-
Notifications
You must be signed in to change notification settings - Fork 205
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
[Feature Request] Add single if statement tearoff (syntactic sugar) #2038
Comments
My choice of |
Keep in mind, you can already do this in one line: if (Navigator.canPop(context)) Navigator.pop(); I don't really think an expression form is needed, since this is inherently a statement with control flow. |
|
The language allows unbraced
And I like it 😁. Some project specific style guides goes further and disallows unbraced I'd wager that the same style guides would also disallow such a |
Might be the OCD, but I want to shave off those extra 4 or 6 characters, And surrounding the conditional with brackets and including Additionally, the brackets in themselves are redundant (optional for our purposes), and a relic of dino conventions. Keep them for onboarding new devs for familiarities' sake, but make them optional for special snowflakes like myself. Hence the introduction of |
I'm going to close this because I don't think it adds any significant value over current syntax. If we want to give users multiple ways of accomplishing the same goal, the new ways should either be noticeably better, or should at least be clearly better in some specific circumstances that the previous syntax doesn't handle well. I don't think either of those apply here, so it's unlikely we'd do this. Having two equally appealing ways to do the same thing just makes them spend mental effort making a choice without giving them anything of value in return. |
Would be great to be able to do something like:
instead of:
Honestly not a must, nor a priority. Just a personal preference, and might benefit many others like me.
Per my comments below, this is to be an optional operator. As in, both of the above can be used interchangeably. The suggested new operator is not a replacement of the standard if statement, but rather like a ternary in its purpose.
The text was updated successfully, but these errors were encountered: