'Lasse R.H. Nielsen' via Dart Misc
2015-11-16 07:07:51 UTC
Making it an error at this point would be a breaking change. It's perfectly
valid syntax by the current specification, even if it's somewhat ridiculous.
On the other hand, it should be caught by any linter or style-checked
because you have a multi-line if statement without braces. Most style
guides disallow that.
The dart formatter would unindent the line after the "else", which shows
you that something is wrong.
I think it would be reasonable for the analyzer to give a hint in cases
like this - you are doing something which looks questionable, and even if
it is actually correct, you could still remove the entire else branch and
make the program shorter and easier to read.
/L
Lasse R.H. Nielsen - ***@google.com
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
valid syntax by the current specification, even if it's somewhat ridiculous.
On the other hand, it should be caught by any linter or style-checked
because you have a multi-line if statement without braces. Most style
guides disallow that.
The dart formatter would unindent the line after the "else", which shows
you that something is wrong.
I think it would be reasonable for the analyzer to give a hint in cases
like this - you are doing something which looks questionable, and even if
it is actually correct, you could still remove the entire else branch and
make the program shorter and easier to read.
/L
An empty else clause is just syntactic noise, and sometimes even confusing
as I had to read the example twice to spot the ';'.
I don't think it's a real problem (I didn't even imagine empty else
clauses before) but I agree that a hint would be nice.
I'm pretty sure there are other priorities, though.
Java and C++ behaving a certain way is not a reason not to try and do
better.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--as I had to read the example twice to spot the ';'.
I don't think it's a real problem (I didn't even imagine empty else
clauses before) but I agree that a hint would be nice.
I'm pretty sure there are other priorities, though.
Java and C++ behaving a certain way is not a reason not to try and do
better.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
Lasse R.H. Nielsen - ***@google.com
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new