On Friday, 2 February 2024 at 21:01:53 UTC, Paul Backus wrote:

No, D only does bottom-up type inference, not top down.

If you want to avoid repeating the type, use `auto` on the left side:

```d
auto time = to!uint(data[1]);
auto priority = to!int(data[2]);
```

Okay thanks. It finally clicked what bottom-up/top-down type interference is.

The auto solution won't work for a struct however which I'm using:

```D
struct procTable{ //contains all the fields inside a file I'm parsing
   uint time;
   int priority;
   string name;
   // etc
   }
```

Reply via email to