You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This introduces `Logarithm` as a new abstract type, which is implemented as `Double`.
34
34
The fact that `Logarithm` is the same as `Double` is only known in the scope where
35
-
`Logarithm` is defined which in the above example corresponds to the object `Logarithms`.
35
+
`Logarithm` is defined which in the above example corresponds to the object `MyMath`.
36
36
Or in other words, within the scope it is treated as type alias, but this is opaque to the outside world
37
37
where in consequence `Logarithm` is seen as an abstract type and has nothing to do with `Double`.
38
38
39
39
The public API of `Logarithm` consists of the `apply` and `safe` methods defined in the companion object.
40
40
They convert from `Double`s to `Logarithm` values. Moreover, an operation `toDouble` that converts the other way, and operations `+` and `*` are defined as extension methods on `Logarithm` values.
41
-
The following operations would be valid because they use functionality implemented in the `Logarithms` object.
41
+
The following operations would be valid because they use functionality implemented in the `MyMath` object.
0 commit comments