ergo icon indicating copy to clipboard operation
ergo copied to clipboard

Implement DateTime within Ergo

Open kach opened this issue 5 years ago • 8 comments

This can be done now that we have importing working. Implementing DateTime within Ergo would:

  1. Simplify the compiler because we don't have to deal with foreign data
  2. Save us the trouble of implementing native datetime support in every backend
  3. Give us free eval for datetime operations, e.g. in the REPL

kach avatar Jul 25 '18 17:07 kach

This is a good issue for contributors because it doesn't require any knowledge of compiler internals; all the code would be written in Ergo itself.

kach avatar Jul 25 '18 17:07 kach

Can I work on this issue?

mbtamuli avatar Oct 22 '19 21:10 mbtamuli

Can someone provide a hint or pointer as to what needs to be done?

mbtamuli avatar Oct 22 '19 21:10 mbtamuli

@mbtamuli Sorry for the lag, we're in the middle of a release which makes it hard to track everything.

This is a great issue to pick! Also a pretty ambitious one. Ultimately the goal would be to re-implement the date and time library in Ergo (currently based on the primitive type DateTime) directly as an Ergo library. The current date and time library is documented here: https://docs.accordproject.org/docs/ref-logic-stdlib.html#functions-on-datetime and parsing/printing of DateTime values is based on the ISO 8601 standard: https://en.wikipedia.org/wiki/ISO_8601

If you consider all the different ways people write dates, issues with timezones, leap years, etc. I could consider this a fairly challenging issue to tackle, so I wouldn't try to do everything at once, but start with a more bite size task first.

That could simply look like:

  1. Create a separate ErgoDateTime structure that captures date/time information (year, month, etc)
  2. Assume everything is in UTC (so not try to tackle timezones)
  3. Not try to address parsing/serialization for the time being, but instead have functions to convert between the current DateTime and the new ErgoDateTime

Let me know if you think that makes sense. Also feel free to join the Ergo calls on Friday morning (9am EST) -- information about those can be found on the #technology-ergo channel on the Accord Project Slack!

jeromesimeon avatar Oct 24 '19 12:10 jeromesimeon

Won't be able to work on this immediately. @irmerk you can reassign to someone else if they want to take this up.

mbtamuli avatar Oct 24 '19 18:10 mbtamuli

Hey Could I work on this issue?

Anjani-225 avatar Mar 18 '20 10:03 Anjani-225

Sure @Anjani-225 !

jeromesimeon avatar Mar 19 '20 13:03 jeromesimeon

Hello Ive implemented a new library with has the DateTime library in ergo itself in this pull request. I have drafted the library keeping in mind the gas costs. I have ignored time zones for now. Please do let me know on how to improve upon it.

Anjani-225 avatar Mar 22 '20 02:03 Anjani-225