Support constraints with future-declared variable
Shaac opened this issue · comments
The following input fails.
input:
- type: int
name: N
min: K
- type: int
name: K
If you ask me, this should probably not be supported, but some people are using it, so I guess iorgen should support it.
Well this is not that simple.
It turns out people are also using the following: structs with two fields, the second having a constraint dependent on the first.
There can be multiple occurrences of a single struct, and then it becomes tricky.
For example, let's say we have a struct with two fields x
and y
, where we say y >= x
. If the input is two such structs, one {x = 0, y = 1}
, the other {x = 2, y = 3}
, then we indeed have the first y
greater than the first x
, but it is smaller than the second x
. And it would make no sense to compare the first y
to the second x
.
So with that example in mind, I would be in favor of saying that when a constraint refers to a variable name, it refers to the last variable with that name. And thus the initial snippet of this issue should not be supported.