Skip to content
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

Bikeshedding the names of the static methods to get current date/time/etc #236

Closed
littledan opened this issue Oct 30, 2019 · 12 comments
Closed
Assignees
Labels
behavior Relating to behavior defined in the proposal

Comments

@littledan
Copy link
Member

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?

@ryzokuken
Copy link
Member

/cc @pipobscure

@pipobscure
Copy link
Collaborator

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

@ryzokuken ryzokuken added the behavior Relating to behavior defined in the proposal label Nov 1, 2019
@ryzokuken ryzokuken added this to the November Meeting milestone Nov 1, 2019
@ryzokuken ryzokuken self-assigned this Nov 1, 2019
@pipobscure
Copy link
Collaborator

Resolution: ?

Temporal.getCurrentDateTime()
Temporal.getCurrentAbsolute()
Temporal.getTimeZone()

@sffc
Copy link
Collaborator

sffc commented Nov 12, 2019

I like maybe?

Temporal.now.absolute()
Temporal.now.timeZone()
Temporal.now.dateTime()

@littledan
Copy link
Member Author

Not sure why there is getTimeZone rather than getCurrentTimeZone above.

@pipobscure
Copy link
Collaborator

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)

@littledan
Copy link
Member Author

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)

@pipobscure
Copy link
Collaborator

pipobscure commented Nov 23, 2019

Ok, from this thread and mentions on other threads I think the conclusion is:

  • Temporal.now.absolute()
  • Temporal.now.dateTime()
  • Temporal.now.timeZone()

Questions:

  1. should we add Temporal.now.date() and Temporal.now.time() as well?
  2. is the assessment that this is the right conclusion from the discussion correct?

(I'd like to close this out and implement it; which is why I'm looking for an answer.)

pipobscure pushed a commit to pipobscure/proposal-temporal that referenced this issue Nov 23, 2019
@sffc
Copy link
Collaborator

sffc commented Nov 23, 2019

should we add Temporal.now.date() and Temporal.now.time() as well?

Personally, yes, I think we should.

@ryzokuken
Copy link
Member

@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?

@sffc
Copy link
Collaborator

sffc commented Nov 26, 2019

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.

@ryzokuken
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behavior Relating to behavior defined in the proposal
Projects
None yet
Development

No branches or pull requests

4 participants