4 ms·
I'll give my two cents here. I work with Dart daily, and it also uses the `await future` syntax. I can cite a number of ergonomic issues: ```dart (await taskA(
by fluffybucktsnek 6mo ago
I'll give my two cents here. I work with Dart daily, and it also uses the `await future` syntax. I can cite a number of ergonomic issues:
```dart
(await taskA()).doSomething()
(await taskB()) + 1
(await taskC()) as int
```
vs.
```rust
taskA().await.doSomething()
taskB().await + 1
taskC().await as i32
```
It gets worse if you try to compose:
```dart
(await taskA(
(await taskB(
(await taskC()) as int
)) + 1)
).doSomething()
```
This often leads to trading the await syntax for `then`:
```dart
await taskC()
.then((r) => r as i32)
.then(taskB)
.then((r) => r + 1)
.then(taskA)
.then((r) => r.doSomething())
```
But this is effectively trading the await structured syntax for a callback one. In Rust, we can write it as this:
```rust
taskA(taskB(taskC().await as i32).await + 1).await.doSomething()
```
- Jtsummers 6mo agoTwo spaces before a line make it a code block literal This is a code block HN has never used markdown so the triple-tick does nothing but create noise here.
- fluffybucktsnek 6mo agoThnaks for heads up, I'll keep this in mind in the future.