New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time and Duration support? #19
Comments
Yes, if Skylark were to have a standard library, time & date would be an obvious first package. For now I suggest you experiment with the package interface you want, and later we can discuss how to share it with others. |
cool. FYI, I have a helper wrapper I'm working on here: https://godoc.org/github.com/hippogryph/skyhook It's mostly just a convenience wrapper using reflection to avoid boilerplate. I'm happy to make a helper library for use with time values. |
time implementation coming along here: https://github.com/hippogryph/time |
So, a question on APIs ... are we going for the same API as python, i.e. everything should work as in https://docs.python.org/2/library/datetime.html transparently? |
Don't copy Python---they've got it wrong so many times. I would use the Go API as a starting point, something like this:
|
Work in progress Fixes #17 Change-Id: Ia4bd6b28b24168d996dc5f159a05d2b153e1fede
I don't have time to work on this but I thought I would share where I got to in case anyone wants to borrow from it: |
@alandonovan this should be solved by the recently added time support. |
@adonovan this issue can be closed as https://github.com/google/starlark-go/tree/master/lib/time exists now. |
Indeed it can. Many thanks for this contribution! |
I know bazel's skylark eschews time functions because they want to ensure reproducibility in their configurations, but this implementation of skylark seems like it could be used for so much more, and at least having access to official skylark time and duration types would keep implementations compatible that otherwise would not be, if consumers all create their own implementations.
Even purely from a configuration standpoint, I could definitely see wanting to be able to specify durations for timeouts, or timestamps for expiration dates, etc.
The text was updated successfully, but these errors were encountered: