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

Bikeshed for method naming conventions #151

Open
nekevss opened this issue Jan 7, 2025 · 0 comments
Open

Bikeshed for method naming conventions #151

nekevss opened this issue Jan 7, 2025 · 0 comments
Labels
C-meta Changes about the repository itself

Comments

@nekevss
Copy link
Member

nekevss commented Jan 7, 2025

There has been various changes in naming for methods over the lifetime of the development of temporal_rs, specifically around the use of snake case in methods and file names. The intended goal of this issue is to come to a consensus moving forward for naming conventions in temporal_rs.

So the first question to answer should probably be:

  1. Should snake case be adhered to 100% of the time regardless of method length?
  2. Should this naming convention also then be extended to filenames and modules?
  3. Should "Plain" be preserved in method names: "to_date" vs. to_plain_date or "to_time" vs. "to_plain_time"

General thoughts

My general thought on this subject is that naming in general is a question of to what degree snake case should be preserved in the general API. For instance, ZonedDateTime as a type is fine for a struct name, but can create some rather long and unyielding method names that may not make the best API if expanded to full snake case, e.g. to_zoned_date_time. In order to avoid long snake case methods that may make methods hard to deal with, ZonedDateTime has been condensed into one "proper" noun of sorts, e.g. to_zoneddatetime.

The issue with doing this type of naming is how it extends to other methods:

  • to_zoned_date_time vs. to_zoneddatetime
  • to_plain_date_time vs to_plaindatetime
  • to_plain_time vs to_plaintime

There are a few general names that have gone through various names and are in scope in connection to this issue (see below).

Time Zone

  • tz, timezone, or time_zone

Time zone has changed in various points.

PlainDateTime / DateTime

  • datetime, plaindatetime, date_time, plain_date_time

ZonedDateTime

  • zoneddatetime, zoned_date_time

General thoughts?

Also, if anyone has any other thoughts regarding to this issue that I may have missed feel free to let me know

@jedel1043 jedel1043 added the C-meta Changes about the repository itself label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-meta Changes about the repository itself
Projects
None yet
Development

No branches or pull requests

2 participants