-
Notifications
You must be signed in to change notification settings - Fork 175
[WIP] Time class #525
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
[WIP] Time class #525
Conversation
Add tests for Time class
Add tests for Time#parse
While Time and Datetime have no significant difference nowadays, Date definitely has its own, separate domain, as it's meant to represent dates regardless of their time zones, which is semantically different from the concept of time (intended as timestamp with time zone). |
This is a complex subject, for a few reasons, and I think it should be entirely separate:
and likely, there are several other problems. I think this should be split into another issue. |
@saveriomiroddi @hachi8833 I think if we make |
Thank you for checking! I'd hold on for a while until discussions are finished. |
And about monkey-patching, I don't want users to do that but we've used it in some standard libraries. So we need a mechanism to lock monkey-patching after the VM is completely initialized. This also requires further discussion. |
@hachi8833 Can you remind me what stop us from finishing this? |
Closing it to re-implementation later |
Implemented a minimum
Time
class in vm/time.go and lib/time.gb:I think we need
Time
class to write loggers or like that.I'd like to ask @st0012 and other contributors how this
Time
class should be extended because this is a language design matter and this should meet st0012's philosophy.My rough memorandom:
Date
orDateTime
class: they are pretty confusing in Ruby. I guess aggregating any methods for date/time/timezone into thisTime
class might be good.Duration
class to represent time durations: for example, the difference between two instances ofTime
spawns an instance ofDuration
class. And adding helper methods like1.month
or2.days
as ActiveSupport does.Time
andDuration
classes standard libs that can be loaded viarequire
to be optional. Especially,Duration
class would mutate numeric classes.ENV
when performingTime#new
.How about this?