-
Notifications
You must be signed in to change notification settings - Fork 153
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
Temporal.now should maybe be Temporal.Now? #1583
Comments
Temporal is currently in Stage 3 so we're no longer considering name changes, so I'm going to close this suggestion. (Thanks for taking the time! I agree that by one possible mental model it's inconsistent. I'm not sure of the rationale, as Temporal.now existed long before I became involved with the proposal, but I'd guess because it was added in order to be a singleton object that is patched out by environments like SES, and that doesn't have the same connotation as a namespace. On the other hand, the intuition does seem to point towards adding a @@toStringTag property to it.) |
I do not recall the casing of I think it is worth reopening this thread on the grounds that we are getting more reviews from ECMAScript Educators. |
I'm concerned about the effect that would have on implementors being able to trust that Stage 3 means done, as we are already incorporating a lot of implementor feedback already that could be disruptive to other implementors. But let's discuss it at the next champions meeting, then. |
Are there any conventions for capitalization of nested namespace objects in userland we can look to? |
The ones I'm aware of are in Microsoft's libraries e.g. https://docs.microsoft.com/en-us/previous-versions/windows/apps/br229774(v=win.10) . |
I tried to google for stuff, and all I found was:
|
As an implementer, name changes don't really concern me as far as post-Stage 3 changes go, so long as it's done before any party has shipped. Temporal has more leeway than other proposals, given its size, that it is unlikely to ship for a while. In this case I'd be more concerned with committee time and reopening bikeshedding discussions, but a strict timebox would solve that. Another data point that shows renaming is a more sanctioned-than-not change is that we've disliked a naming decision so much we renamed it after shipping. Atomics.wake was renamed to Atomics.notify because an engineer at Bocoup realized how difficult it is to disambiguiate "Atomics.wait" and "Atomics.wake" in a spoken sentence. We took advantage of the Spectre-caused unshipping of SABs and Atomics and renamed the method. |
Well, we have convention for namespace objects, which is that they're capitalized. When I ran that survey for whether we should do |
We discussed this in the champions meeting of 2021-07-08 and if there are no objections to renaming from the editors' side, then none of us have any preference as to whether it is |
Seems reasonable. Would you like to add a late-addition discussion item to the agenda for the meeting next week? We have a light schedule. |
Also schedule constraints See tc39/proposal-temporal#1583 (comment)
Sure, this is done at tc39/agendas#1024 |
This line of argument can also be applied the other way around: If the general expectation was that constructors are capitalised, capitalising |
Yep, from my anecdote alone that's also a reasonable extrapolation. But more than constructors are capitalized, so I feel like the other direction is weaker. |
In the plenary meeting today, someone brought up that it'd be helpful to have a specific definition of what a "namespace" is, under the assumption that by having a clear definition it'd be easier to decide what to do for nested ones. So I took a stab at a definition. I'm probably off-base with some of the terms I use below and perhaps some of the requirements, but the best way to get a good answer on the Internet is always to post a less-good answer. My less-good answer is below. BTW, the text below assumes that nested namespaces should be capitalized but it's easy to change to lowercase if that's how the winds are blowing. I don't have a strong opinion either way. A namespace is an ECMAScript object that satisfies all of the following conditions:
|
Virtualization of
This is a bit awkward since all of the Temporal.now methods do in fact have internal and observable state - the current date, time, timezone, etc. The |
@syg - sorry I had a conflict and couldn't attend today's discussion about namespaces, but sounds like there's a clear path going fwd and you're owning the writeup of "what's a namespace" which I'm sure will be much more clear than my draft above. Correct? If so that's great!
@ljharb - maybe the same caveat applies here as with "no mutable state". Once virtualization or monkeypatching comes into the picture, then the singleton requirement may not apply or may apply with caveats, e.g. will only be a singleton after any virtualization and/or patching is completed. Given that patching and virtualization typically happens at initialization, the meat of user programs will only see a singleton.
The methods have state, but the namespace object doesn't. What I was attempting to convey is that a namespace object is just a dumb container and it delegates all smarts (including state) to the objects that its properties point to.
I have no opinion about how the writeup should be structured. Your suggestion seems reasonable. |
BTW, this was implied above but stating it more clearly: the consensus from yesterday's TC39 plenary meeting was to rename |
I think the standard for namespace objects (such as Temporal or Math) is to capitalize them.
Temporal.now is a namespace object that lives in another namespace object, but I think it should still be capitalized?
The text was updated successfully, but these errors were encountered: