From 9d57cf2758e3fbcfcb85bea6f1d4b05c9c778d2d Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sat, 22 Jun 2024 10:57:06 +0200 Subject: [PATCH] docs: "Interface Introduction" chapter updated --- .../framework_basics/interface_introduction.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/users_guide/framework_basics/interface_introduction.md b/docs/users_guide/framework_basics/interface_introduction.md index 9f3de85c..31ebef0a 100644 --- a/docs/users_guide/framework_basics/interface_introduction.md +++ b/docs/users_guide/framework_basics/interface_introduction.md @@ -22,6 +22,9 @@ behind this is that: a user's written code, a new idiom in the library is to use the same identifier for a type and its instance. + Also, to prevent possible issues in compile-time logic, all of the library's entities must be + marked `final`. This prevents the users to derive own strong types from them, which would + prevent expression template simplification of equivalent entities. ## Strong types instead of aliases @@ -234,6 +237,17 @@ the resulting expression template. | `power, per` | `power` | | `A, per>` | `{identity}, per` | + It is important to notice here that only the elements with exactly the same type are being + simplified. This means that, for example, `m/m` results in `one`, but `km/m` will not be + simplified. The resulting derived unit will preserve both symbols and their relative + magnitude. This allows us to properly print symbols of some units or constants that require + such behavior. For example, the Hubble constant is expressed in `km⋅s⁻¹⋅Mpc⁻¹`, where both + `km` and `Mpc` are units of _length_. + + Also, to prevent possible issues in compile-time logic, all of the library's entities must be + marked `final`. This prevents the users to derive own strong types from them, which would + prevent expression template simplification of equivalent entities. + 4. **Repacking** In case an expression uses two results of other operations, the components of its arguments are repacked