Conversation
JohnReppy
left a comment
There was a problem hiding this comment.
This implementation is bogus. The size of the "tick" is set by the runtime system and may differ from OS to OS. It is also the case that maybe it should be a function that returns the smallest time quanta, instead of a Time.time value.
|
The intention of |
|
This is a replacement for the code: fun smallestTime () = let
fun go n = if Time.zeroTime = Time.fromNanoseconds n then go (n * 10) else n
in go 1 end
val tick = Time.fromNanoseconds (smallestTime ())This is |
|
I had misremembered the discussion about |
This PR adds some additional functions to different structures.
Description
Time.tick
This is the smallest time value. It is useful to be able to know what the smallest time unit is in code, and this addition was recommended in SMLFamily/BasisLibrary#35.
Universal.tagTryProject
It is a common usage pattern to do the following:
Because
universalis implemented using an optional, this code performs additional checks.It also encourages a bad pattern (check + unwrap) instead of pattern matching.
Now one can write:
Unsafe.ptrEq
This definition was referenced in #327, and it makes sense to add it to the
Unsafemodule to bless this as a valid implementation.How Has This Been Tested?
Time.tickandUniversal.tagTryProjectare trivially tested, but these are trivial additions.Unsafe.ptrEqhas not been extensively tested.