feat(quantities): IPhysicalQuantity surface + typed In() (closes #59, #61)#79
Merged
Merged
Conversation
Extend docs/architecture.md beyond strings/paths to cover the metadata-driven physics quantities subsystem: source-of-truth files, generator pipeline diagram, vector-form invariants, and SEM001-SEM004 diagnostics. Add SEM004 to the README diagnostic list. https://claude.ai/code/session_01LqtywMUn5GwFATD5FDdLn6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two issues landed on the vectors branch.
Closes #61 — docs
Extend
docs/architecture.mdbeyond strings/paths to cover the metadata-driven physics quantities subsystem:dimensions.json,units.json,magnitudes.json,conversions.json,domains.json).Magnitude()).IPhysicalQuantity<T>contract and typedIn(I{Dim}Unit)pattern.Also adds the missing SEM004 entry to the diagnostic list in
README.md.Closes #59 — IPhysicalQuantity surface
Implement the canonical
IPhysicalQuantity<T>contract with compile-time dimension safety on unit conversion.Runtime:
IPhysicalQuantity<T>now exposesDimension(DimensionInfo),IComparable<IPhysicalQuantity<T>>,IEquatable<IPhysicalQuantity<T>>.CompareTothrows on cross-dimension comparison;Equalsreturnsfalse(equality is total).IUnitgainsName/Symbol/Dimension/ToBaseFactor/ToBaseOffsetplus default-implementedToBase<T>/FromBase<T>over the affine conversionbase = value × factor + offset.UnitConversionException(reserved for any future untyped path).Generator:
DimensionsGeneratoremits a marker interface per dimension (I{Dim}Unit : IUnit).UnitsGeneratorcombines units.json with dimensions.json so each unit implements the rightI{Dim}Unitmarker(s). Emits class records (not structs) with full property surface and folds metric magnitude + conversionFactor into a singleToBaseFactor. Emits a staticUnitscatalogue of singletons.QuantitiesGeneratoremitsDimensionoverride + typedIn(I{Dim}Unit)on every V0/V1 base + V0/V1 overload type.Out of scope (follow-up):
In()(vector types don't implementIPhysicalQuantity).Heads-up — landed without local build verification
Per discussion in this session, the sandbox build is blocked by an analyzer mismatch unrelated to this change (existing committed files fail IDE0055 on net8 with the current SDK). The full design lands here and CI is the source of truth — expect to iterate.
Test plan
Semantics.Quantitiesfor all four TFMs (net7/8/9/10).PhysicalQuantityCoreTests(Length+Kilometer = 0.01, Temperature+Celsius = 26.85, CompareTo / Equals cross-dim behaviour).Semantics.Quantities/Generated/and verify the newDimension+In(...)members appear on every V0/V1 type.https://claude.ai/code/session_01LqtywMUn5GwFATD5FDdLn6