Summary
docs/strategy-unified-vector-quantities.md explicitly flags this as an open question:
Design decision needed: What happens when subtracting two Vector0 values would produce a negative result?
- Return the absolute value of the difference
- Throw an exception
- Don't define subtraction on Vector0 at all
- Return a Vector1 (the signed difference)
The generator has unilaterally picked option 4: Semantics.SourceGenerators/Generators/QuantitiesGenerator.cs:388-407 emits V0 - V0 => V1 when a V1 form exists.
Problems with the current behaviour
- Silent design choice — the strategy doc still lists this as undecided, so consumers won't know what to expect.
- No fallback for scalar-only dimensions — quantities like
Mass, Energy, Area have no V1 form. The generator either skips subtraction entirely (loss of arithmetic) or could emit something invalid; this is not documented.
- No tests assert the chosen semantics in
Semantics.Test/SemanticQuantityTests.cs.
Suggested next step
- Pick a documented option per dimension (probably hybrid: option 4 when V1 exists, option 1 with
T.Abs(...) otherwise).
- Update
docs/strategy-unified-vector-quantities.md to state the chosen semantics.
- Emit consistent operators in the generator and back them with tests.
Area / Severity
SourceGenerators / Docs · incomplete
Summary
docs/strategy-unified-vector-quantities.mdexplicitly flags this as an open question:The generator has unilaterally picked option 4:
Semantics.SourceGenerators/Generators/QuantitiesGenerator.cs:388-407emitsV0 - V0 => V1when a V1 form exists.Problems with the current behaviour
Mass,Energy,Areahave no V1 form. The generator either skips subtraction entirely (loss of arithmetic) or could emit something invalid; this is not documented.Semantics.Test/SemanticQuantityTests.cs.Suggested next step
T.Abs(...)otherwise).docs/strategy-unified-vector-quantities.mdto state the chosen semantics.Area / Severity
SourceGenerators / Docs · incomplete