SciNim / Unchained

A fully type safe, compile time only units library.
https://scinim.github.io/Unchained
110 stars 0 forks source link

Generate units from macro, add `sqrt`, `abs`, `*=` and friends #21

Closed Vindaar closed 2 years ago

Vindaar commented 2 years ago

This includes the first step towards refactoring out the actual unit definitions from the logic that handles the CT checking.

The idea is to generate everything from a macro declaration that at some point will live in a si_system.nim file or something. Other systems can then be added that define their own units.

For that to become properly useful, we also need to generate the QuantityKind, UnitKind and BaseUnitKind as well as the related procedures from some declarative context.

Once these things are done however (and a general refactor of parsing / declaration / math / etc) has been done, general unit systems should be plug and play.

From there adding logic that describes how different systems can interop with one another becomes possible to reason about.

Other things in this PR