On Sunday, 26 February 2023 at 14:17:50 UTC, ryuukk_ wrote:
On Sunday, 26 February 2023 at 07:11:55 UTC, Paul Backus wrote:
Since `Expression` contains `Binary` and `Unary`, and `Binary`
and `Unary` contain `Expression`, that means `Expression`
contains itself--which is not allowed, because it would result
in `Expression.sizeof` being infinite.
It should display the proper error message then
Example of error message for this particular error with zig:
```
An error occurred:
/tmp/playground921468696/play.zig:4:20: error: union
'play.Expression' depends on itself
const Expression = union(enum) {
^~~~~
/tmp/playground921468696/play.zig:23:5: note: while checking this
field
expr: Expression
^~~~~~~~~~~~~~~~
/tmp/playground921468696/play.zig:8:5: note: while checking this
field
group: Group,
^~~~~~~~~~~~
referenced by:
callMain: /usr/local/bin/lib/std/start.zig:604:17
initEventLoopAndCallMain:
/usr/local/bin/lib/std/start.zig:548:51
remaining reference traces hidden; use '-freference-trace' to
see all reference traces
```
I don't particularly enjoy zig, but they tell us how errors
should be reported to the users, they do it very nicely