aboutsummaryrefslogtreecommitdiff
path: root/STYLE.md
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-06-13 03:32:21 +0000
committerGravatar Runxi Yu2026-06-13 04:59:51 +0000
commitbe63ecd9711b46135bbff1769c2e4c3642255ef1 (patch)
treed5581c8b2e438af2b8ae82dd8f200393b2dbc5d3 /STYLE.md
parentTODO: Update (diff)
Unify lengths
Diffstat (limited to 'STYLE.md')
-rw-r--r--STYLE.md17
1 files changed, 13 insertions, 4 deletions
diff --git a/STYLE.md b/STYLE.md
index 39ef9ff1..546bcb94 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -22,12 +22,21 @@ the package's central type, `New`, `Close`, etc.
Options structs should be close to `New`.
There should not be an `options.go`.
-## Sizes
+## Sizes and offsets
-Sizes are typically `uint64`.
-Use `intconv` for conversions where necessary.
+In-memory sizes and offsets are `int`.
+They are bounded by `len()`,
+and anything too large for `int` cannot be held in memory anyway.
-**TODO:** revisit this and consider whether to make sizes `int`.
+On-disk and wire-format fields stay `uint64`,
+faithful to their serialized representation.
+Convert at the boundary with `intconv`.
+
+Convert a value where it is stored or crosses into a domain,
+not for a transient one:
+a short-lived result can keep its producer's type,
+widening the other operand at a comparison
+rather than being narrowed to match.
## Comments