Skip to content

Proof of concept: angle types#169

Open
klukasiuk wants to merge 1 commit intomainfrom
angle_types
Open

Proof of concept: angle types#169
klukasiuk wants to merge 1 commit intomainfrom
angle_types

Conversation

@klukasiuk
Copy link
Copy Markdown

Add strongly typed angle units (Degrees and Radians) with conversions and arithmetic

@klukasiuk klukasiuk requested a review from jauhien March 12, 2026 12:56
@sbarral
Copy link
Copy Markdown
Member

sbarral commented Mar 12, 2026

It would be good to add a design rationale, in particular why we would want to design our own when crates like uom, angular_units and ang already exist.

uom in particular covers much more ground and I prefer its design in the sense that type parametricity only concerns the quantities (Length vs Angle vs Mass etc) but not the units themselves. An angle in degree and an angle in radians are the same type in uom, the unit is only seen at the boundaries when defining constants and reading a result. In this design and in angular_units (I haven't looked at ang), the way the type of the sum of degree and radian angles is chosen feels arbitrary.

Defining conversion functions like Degree::to_radians may not scale too well if we want to generalize to quantities like length etc which have many common units.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants