On Tuesday, 24 February 2026 at 19:01:35 UTC, monkyyy wrote:
Consider the `old` function, a tagged union would add a layer of indirection that does nothing.

```d
enum animalid{cow=7,chicken,horse};

struct animal{
    animalid id;
    string say;
    int age;
}
```

This is a tagged union. Both the D and the Nim that I posted have a check against the tag that's technically unnecessary, but what you're doing here is like saying that you don't want to use arrays "because array indexing comes with an array bounds check and that slows down access".

Reply via email to