Naming convention from from/toTime
KevinWMatthews opened this issue · comments
Is the naming convention for fromTime
and toTime
reversed? Intuitively I expect toTime
to return a Time
:
toTime : Int -> Time
and fromTime
to accept a Time
as an input:
fromTime : Time -> Int
much like the fromPosix
and toPosix
functions. The actual API for Time
is the opposite.
Perhaps fromInt
/toInt
? There is some precedent for fromMillis
/toMillis
in the elm/Time
package.
I'm still new to Elm, so if you're willing to share your mental model it would help me out quite a bit. I see that you've touched these functions recently in #9 , so perhaps there's some reasoning behind the convention that I'm not aware of.
Thanks!
Ah yes, good point.
The reason these are named this (and it took me a while to recall) is Elm used to represent Time
as an Int
.
The fromMillis
/toMillis
makes much more sense (until Elm adds a Millis
type), so maybe fromInt
/ toInt
. Let me chew on this for a bit.
Ah, I see - I didn't know that corner of Elm history.
Take your time - this would be an API change, which warrants more than a moment's thought.
Thanks!