When writing container implementations for some complex types it makes sense to extract multiple component numbers from the data buffer in one go. For example it would be natural to write processors like this:
[codegen.processor]
type = "types::st::Pair<DB, types::st::VarInt<DB>, types::st::Pair<DB, types::st::VarInt<DB>, types::st::VarInt<DB>>>"
func = "..."
[codegen.processor]
type = "types::st::List<DB, types::st::VarInt<DB>>"
func = "..."
This generally works and should be a supported pattern.
However, this doesn't work. The chained writes are invalid because it's attempting to write to a Pair<Pair<VarInt, ...>, ...>.
The generated type is (DB omitted for clarity):
using type = Pair<Pair<VarInt, Pair<VarInt, VarInt>>, List<VarInt>>
At least for this layer this is really easy to fix. Instead of guaranteeing the first pair returns a Unit from the write, see what it returns and instead return a Pair<decltype(first.write(X)), second>. I think this scales too.
When writing container implementations for some complex types it makes sense to extract multiple component numbers from the data buffer in one go. For example it would be natural to write processors like this:
This generally works and should be a supported pattern.
However, this doesn't work. The chained writes are invalid because it's attempting to write to a
Pair<Pair<VarInt, ...>, ...>
.The generated type is (DB omitted for clarity):
using type = Pair<Pair<VarInt, Pair<VarInt, VarInt>>, List<VarInt>>
At least for this layer this is really easy to fix. Instead of guaranteeing the first pair returns a Unit from the write, see what it returns and instead return a
Pair<decltype(first.write(X)), second>
. I think this scales too.