dart-lang / dart-lang/language

`assert` code block

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

Description

The current way to perform static computation is by using `assert`. It's ugly and it's abusing its original intention.

```dart
assert(() {
// run static computation
return true;
}());
```

Why not simply borrow the syntax from C++?

```c++
static {
// run static computation
}
```

Contributor guide

Open the contributing guide

Research direction

The issue compares Dart's current assert-based static computation with a proposed C++-style static block, but names no files, tests, or specification sections. Start by reviewing how static computation is currently defined in the Dart language specification and determine the syntax and semantics such a block would require. Done would require an accepted language-design decision and corresponding specification work.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.