RFC: introduce notations for `Duration` and `Timestamp` and remove dangerous `OfNat` instances
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Proposal
We currently provide OfNat Duration and OfNat Timestamp instances which turn natural numbers into seconds and seconds since Unix epoch, respectively. Keeping with the design of "make incorrect conversions impossible and make dubious conversions explicit", we should change this as follows:
- Introduce notation for
Durationtypes (this was considered during initial implementation, but was postponed to reduce the size of the PR). - Add
Timestamp.ofDurationSinceUnixEpoch(this is just the constructor). - Remove the
OfNat DurationandOfNat Timestampinstances. - Possibly introduce notation for
Timestampthat allows entering a timestamp with time zone in ISO format without having to go throughZonedDateTime.
Impact
Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Duration and Timestamp definitions and their current OfNat instances. Review how existing notation and ZonedDateTime APIs are implemented before assessing the proposed Duration notation and Timestamp.ofDurationSinceUnixEpoch constructor. Done would require an agreed design covering the notation, constructor, removal of both instances, and whether ISO timestamp notation is included.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100