-
Notifications
You must be signed in to change notification settings - Fork 152
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
Redefine civil.md #144
Redefine civil.md #144
Conversation
Attempt to more fully explain why Local is the right choice - though this style of document isn't a great way to do so.
@pipobscure @mj1856 @sffc your take on this? |
Co-Authored-By: Ujjwal Sharma <[email protected]>
Local comes from Latin locus "a place, spot, position," from Old Latin locus, literally "where something is placed”. So while I empathise, it literally is the single quality civil objects don’t have. As to the airline example: that’s the exact opposite of why the pilot says “local time will be...” he says that specifically to indicate that the time on the ground in that specific location may be different to what a passenger may have on their watch. In short this has just proven why Local is exactly the wrong prefix. |
In computing, we often name things based on what they have so I understand why people find this naming hard (eg. When I ask "what is your local time", the answer is "6pm". It is not "6pm in New York". Sure, the context of the question implied a location, but the answer did not include that location. The context is external and implied. It is the answer to the question that is being modelled here - not the question nor the context. |
Agreed. A "local date/time" is a date/time that works and can be used locally. It is not a date/time that has a location. (That would be "DateTimeWithLocation", or "LocalizedDateTime", or, as this proposal calls it, "ZonedDateTime".) For my part I don't really care about this prefix, but I have found the arguments of the form "LocalDateTimes don't have a location and therefore it's a bad name" to be kind of missing the point. |
One potential point of confusion for developers is that we don't want to conflate "local" with "locale" (as in internationalization). In the absence of strong motivation, I would rather avoid using any variant of that word (local, localized, etc.) to mean anything other than i18n. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. In general though, we should update this document still with the assumption that we are moving forward with the Civil prefix. This PR is not the right place to make a case to change the prefix; please use #33 for that.
@@ -1,4 +1,4 @@ | |||
# The naming of Civil objects | |||
# The naming of objects not tied to a specific time-zone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the title change.
* `CivilDateTime` represents a date and time without a timezone or locality | ||
* `CivilYearMonth` repreents a year and month without a day or time or timezone or locality (think: July 2019) | ||
* `CivilMonthDay` represents a day and month without a year or time or locality (think 25th of December); | ||
* `XxxDate` represens a date without a time that is not tied to a specific time-zone (eg: date of birth 1st January 1980) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep these with the Civil prefix
**Con:** Gregorian requires knowledge of the fact that the *proleptic gregorian calendar* is what most of the western world uses. This is not knowledge we can assume. | ||
|
||
**Con:** `CivilTime` does not in any way depend on the gregorian calendar. In fact it is a secondary characteristic: *the midnight to midnight* day definition. Even in cultures that use the gregorian calendar, this definition may not apply (think Ethiopia). So gregorian would be factually wrong for times and misleading in combination with some calendars. | ||
|
||
## Local | ||
|
||
**Pro:** Local is the prefix that many programming languages use for this type of object. It is therefore very intuitive to many users. | ||
**Pro:** Local is the prefix that many programming languages use for exactly these types of object for around 20 years. It is therefore very intuitive to many users and widely defined in internet searches and help forums. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add this line, please include citations and examples.
**Con:** Local is the prefix that many languages use. However the `Civil` objects are part of a larger whole with a very specific mental model. Local violates that mental model and by suggesting analogies to other languages it exacerbates that misunderstanding of the meaning and value of these types. | ||
**Pro:** The term "local time" is in widespread use, both in scholarly articles and common parlance. For example, airline pilots will typically say "when we land the local time will be 7pm". | ||
|
||
**Con:** Local names a characteristic that these objects do not possess: locality. But surely this misunderstands how "local" is used in English - as with the airline case, the phrase "local time" doesn't refer to knowledge of the locality, but the absence of needing to worry about it on your watch/phone once it is set correctly. As a related example, talking about your "local shop" doesn't require identifying a specific shop in a specific locality. Instead it is a phrase used to discuss whatever the shop nearest to you is, something that varies depending on where you are. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The language "But surely this misunderstands" is too strong. Please soften up the new material you added in this bullet.
|
||
## Civil | ||
|
||
**Pro:** Civil is an usused prefix that suggests that these objects are used to represent things used by civil society. | ||
|
||
**Con:** Because Civil is a hitherto unused prefix, it does not lend itself to easy comprehension without the entire mental model. | ||
|
||
**Con:** Some will consider "civil" to be naming the calendar system, effectively bringing all the cons listed in that section above. | ||
|
||
**Con:** Relatively few non-English speakers will know what Civil means. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a con? The fact that non-native English speakers are less likely to recognize this word means that they may read the documentation more closely and learn the concept correctly, rather than relying on false presumptions (such as assuming local implies locality).
@jodastephen was explicitly asked in #33 (comment) to make this PR:
Now he's being told that he shouldn't have made the PR. As someone from outside the TC39 world, I'm finding it really confusing to know how to contribute to this proposal. There are many mixed messages being delivered. |
@gilmoreorless sorry, this is just a case of lack of communication between me and @sffc Shane, I requested them to make a PR with their thoughts precisely so that we could discuss and scrutinize the arguments made in a productive manner since the discussion on #33 wasn't exactly going places. Since you've already posted your opinions on their arguments, I guess this seems to be working as expected. |
Is the intention to merge this PR or to keep it open indefinitely for discussion? I reviewed this PR last night with the intention of eventually merging it. |
Yes, the intention is to merge it after comments have been addressed but also to mainly to have a place to document the criticisms to the civil prefix. |
@jodastephen, can you address my review feedback? Then we can merge this PR. Thank you 😄 |
In short, I severely disagree with using the I'll try to take a new train of thought here:
In short we could eliminate this entire discussion by simply dropping the prefix entirely if we use the import { Date } from 'std:temporal';
const date = new Date(1976, 11, 18); // November 18th 1976 which would be confusing since const date = new Date(1976, 11, 18); // December 18th 1976 However using a global namespace object the pattern would be: const date = new Temporal.Date(1976, 11, 18); // November 18th 1976
const legacy = new Date(1976, 11, 18); // December 18th 1976 which seems pretty clear. Any case: I don't think this is mergable without further debate. |
Based on the love shown, I have updated the polyfill. We'll go with the Temporal namespace object instead. |
Hmm. 4 likes compared to 18 for I've not responded to the PR because it seemed fairly pointless for me to do so. The file Since writing the PR I contacted someone I know in Google. Apparently, the term "civil date" has been widely pushed within Google by the authors of the Abseil C++ library (which is a Google authored library). Those Googlers suggesting C++ Abseil as a reference should be clear as to the connection given the strong link between Abseil and Google. The naming discussion should not IMO be based solely on the opinion of Google's internal naming choices. I will say that Having done some research in my email history, the naming discussions for JSR-310 happened in October and November 2007 (unfortunately lost to the internet, though I have a copy personally). Most of the suggestions that have come up here were considered along with a few others: The result that
In summary, |
Thanks for the information! I hadn't even known about the whole Google naming angle (I'm with Bloomberg). You are correct in That of course indicated to me that Civil is not the right answer. Whence the call to simply omit any prefix and just put them all into the Temporal namespace object. In terms of using
I have been around for a while, and have never met a programmer that intuitively understood what LocalDate actually means and what's the difference to LocaleDate or anything else. So while there might be ample precedent, there are many bad things in the world that have ample precedent and I consider this to be one of those bad things. I do agree with you that Here is the way I'm thinking about using this: const { Date, Time, DateTime, ZonedDateTime } = Temporal;
... I'm also about to add the following: const { Local } = Temporal;
Local.timeZone(); // a TimeZone object containing the system time-zone
Local.instant(); // current moment as an Instant
Local.date(); // a Date object having the current date
Local.time(); // a Time object having the current time
Local.dateTime(); // a DateTime object having the current date & time
Local.zonedDateTime(); // a ZonedDateTime object representing the current time In the end I think this will make working with the object fairly easy. Especially since the const lunch = Local.date().withTime({ hour: 12 }); With that, I hope you'll give me the time to update all the documents and documentation and release the polyfill to npm again to allow actually playing with it and exploring whether this actually works. Cheers, Philipp P.S.: Once the documents have all been updated, I of course welcome the debate to reopen. |
A quick comment - I think However, I think |
@pipobscure note that adding any way in Temporal to get the current date or time will create strong objections from some committee members; I'd suggest getting consensus on such a change before making it. |
@ljharb I’m aware. Which is why I did it in a way/place that is easy to remove/secure. I’ll mention it in context with SES in documentation and during the update. |
@pipobscure I agree with using a
I don't see how one is any more or less confusing than the other: const { Date } = Temporal
// vs.
import { Date } from 'std:temporal' |
Attempt to more fully explain why Local is the right choice - though this style of document isn't a great way to do so.