I see that these are called getAbsolute(), getYearMonth(), getTimeZone(), etc. A couple issues with these names:
Some options that come to mind:
Temporal.getCurrentAbsolute() -- current is already everyone's favorite meaningless variable name when you can't think of anything, so it'd be a great fit for this bikeshed!Temporal.now.getAbsolute() -- grouping it on a singleton object which represents "now" could make it more explicit (since the Temporal namespace doesn't really indicate that). We could even call this singleton object Temporal.current!I have to say, I'm not very excited about these options either... does anyone else have any ideas?
/cc @pipobscure
I have no passion either way. I’d also be fine to reduce them two just two;
Temporal.here() // current TimeZone
Temporal.now() // current Absolute
Resolution: ?
Temporal.getCurrentDateTime()
Temporal.getCurrentAbsolute()
Temporal.getTimeZone()
I like maybe?
Temporal.now.absolute()
Temporal.now.timeZone()
Temporal.now.dateTime()
Not sure why there is getTimeZone rather than getCurrentTimeZone above.
Is the Timezone ever NOT current? What does “current” add to the meaning?
(Any justification will do, I was just thinking that the TZ is not ever going to be non-current; in contrast with an Absolute that would change every 10e-9 seconds)
Well, for example, a compound ZonedDateTime might have a way to project out a time zone, but it wouldn't be the current one. (I agree that "current" is bad; personally, I prefer @sffc's suggestion above)
Ok, from this thread and mentions on other threads I think the conclusion is:
Temporal.now.absolute()Temporal.now.dateTime()Temporal.now.timeZone()Questions:
Temporal.now.date() and Temporal.now.time() as well?(I'd like to close this out and implement it; which is why I'm looking for an answer.)
should we add Temporal.now.date() and Temporal.now.time() as well?
Personally, yes, I think we should.
@sffc I'm a bit in favor of not having those (since they're just one method call away from DateTime). Would you mind sharing why you think we should have them?
Having separate methods is a bit shorter, but the main advantage is that it could open up performance gains. For example, computing the year/month/day might be more expensive than computing the hour/minute/second (or vice-versa), and having to detour through DateTime requires creating an extra object. This is a theoretical concern for which I have no data.
Okay, I understand your concern. I usually try to advocate for avoiding things which we absolutely need, but given your concern, I don't have a strong preference here.
Most helpful comment
I like maybe?