Make implicit units on TimeInterval explicit

... or, just like DispatchTime is, wrap the raw value in a struct. This can be done in the Swift overlay.

The Measurement API is also not that pretty. You have to write some awkward generic type, and the dimension names are not always obvious. I think we could improve usability significantly by providing some typealiases which hide the underlying generics, for example:

enum Unit {
  typealias Time = Measurement<UnitDuration>
  // ..etc
}

func performAction(timeout: Measurement<UnitDuration>) // yuck
func performAction(timeout: Unit.Time) // much better

You mean something like suggested by @ole back in 2016 here? :wink:

2 Likes

I had no idea about that - but yes, there are loads of great ideas in there!