Summary
flushPipeline and exec return seq[string]:
https://github.com/nim-lang/redis/blob/a0f8216/src/redis.nim#L430
https://github.com/nim-lang/redis/blob/a0f8216/src/redis.nim#L1267
Flattening every reply to strings destroys information that pipeline
callers need:
-
No 1:1 mapping. Status acknowledgments are filtered out and an
empty array reply contributes zero strings, so N commands can
produce fewer than N entries. Callers match results to commands by
position, so any missing slot silently attributes every later result
to the wrong command:
r.multi()
discard r.lRange("cart:items", 0, -1) # empty list
discard r.get("cart:owner") # "alice"
let res = r.exec()
# res == @["alice"]: one entry for two commands, and it looks like
# the answer to the lRange
Pipelines are dominated by loop-generated batches (N runtime items,
often several commands per item consumed in strides), where
positional integrity is the entire contract.
-
Type ambiguity. An integer reply of -1, a nil reply, and the
literal strings "-1" and "" are indistinguishable after
flattening, and redisNil ("\0\0") is an in-band sentinel that
collides with real data.
-
Structure loss. A reply that is an array of arrays arrives as
one flat list with the boundaries erased.
These are properties of the seq[string] return type itself and cannot
be fixed behind the current signatures.
Summary
flushPipelineandexecreturnseq[string]:https://github.com/nim-lang/redis/blob/a0f8216/src/redis.nim#L430
https://github.com/nim-lang/redis/blob/a0f8216/src/redis.nim#L1267
Flattening every reply to strings destroys information that pipeline
callers need:
No 1:1 mapping. Status acknowledgments are filtered out and an
empty array reply contributes zero strings, so N commands can
produce fewer than N entries. Callers match results to commands by
position, so any missing slot silently attributes every later result
to the wrong command:
Pipelines are dominated by loop-generated batches (N runtime items,
often several commands per item consumed in strides), where
positional integrity is the entire contract.
Type ambiguity. An integer reply of
-1, a nil reply, and theliteral strings
"-1"and""are indistinguishable afterflattening, and
redisNil("\0\0") is an in-band sentinel thatcollides with real data.
Structure loss. A reply that is an array of arrays arrives as
one flat list with the boundaries erased.
These are properties of the
seq[string]return type itself and cannotbe fixed behind the current signatures.