dart-lang / dart-lang/language

Question: Why allow empty statements?

Open
#1,891 7 comments 3 reactions 0 assignees View on GitHub
request
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

This is more of a question than necessarily a bug in the spec.

Linting options (https://dart-lang.github.io/linter/lints/empty_statements.html) flag the usage of `;` as in

```
print("Hello World");
;
```
as unnecessary and state that it should be avoided. This seems self-explanatory.

It further says that
> Empty statements almost always indicate a bug

What I am wondering: When is that not the case? When is it ever useful to have an empty statement using `;`?

Contributor guide

Open the contributing guide

Research direction

Start with the empty_statements lint page linked in the issue, then review the Dart language specification's treatment of empty statements and semicolons. The issue names no file or test; completion would require an agreed explanation of valid uses, or a clarified specification or lint recommendation.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.