nodejs/node

Let's enable Temporal by default

Opened this issue ยท 16 comments

What is the problem this feature will solve?

The Temporal API is nearing completion in TC39 and is largely stable. It is not turned on by default in V8 just yet until it reaches stage 4 but platforms are starting to enable it by default. We ought to be able to go ahead and enable it by default in main

What is the feature you are proposing to solve the problem?

Enable Temporal by default but still marked as experimental

What alternatives have you considered?

No response

It would probably be wise to wait until it's been fully shipped unflagged on the web for a bit - maybe for node 25?

Either way. I'm going to prepare a PR but it's fine to let it sit for a bit

On one hand, I can't wait for Temporal to be available, but on the other hand, I can wait and use the polyfill a while longer. So far the experience of enabling flagged features of V8 has been mixed (TLA was a success, the import assertions syntax not so much); given this is fully polifillable, I'm not sure it's worth the risks (although I reckon the risks are very mild at worst).

Can someone link to the tracking issue in V8 so we have some information on the progress of the implementation there?

I wonder if it passes the existing test262 tests for Temporal.

Yep, I'm fine with waiting a bit but I wanted to at least get it on the radar here. I'm not in any rush to merge it. V8's test coverage on this is currently hovering around the 75% mark but that is expected to increase significantly in the coming couple of months. My current thinking is that we can let the PR sit and look at merging it still as experimental after 24.0.0 is cut in April with a flag to disable it.

syg commented

I strongly recommend against unflagging Temporal while it is still flagged in V8. The stability of the proposal has no correlation with the quality, stability, and completeness of the implementation in V8 itself. If Node does choose to unflag a feature before V8 thinks it is ready for production, we will not be prioritizing bugs, which will frustrate everyone involved.

If we unflag it (which is still far from settled), it wouldn't be until after 24.0.0 at the earliest and would remain in experimental status until v8 unflags it... which is to say we wouldn't actually expect v8 to prioritize bugs beyond whatever y'all are doing now... but conversations like this are precisely why I opened the issue with the proposal, so these things can be discussed.

Current V8 implementation of Temporal API is not only incomplete but based on the outdated proposal. Plenty of normative changes are not reflected to the implementation, which can make users confused.

Even the API surface has changed. FYI Deno patches Temporal classes to minimize the deviation on the public API by removing and adding methods and properties.

https://github.com/denoland/deno/blob/aa1f43702dc79021fe1dfa99e44733aa345a7dce/runtime/js/99_main.js#L498

Despite the effort of Deno, not a few issues (including V8 panic) are reported in the issue tracker.

https://github.com/denoland/deno/issues?q=label%3A%22upstream%22%20temporal

Honestly, I feel that V8 implementation is far from 'experimental', rather it's 'draft'.

See https://chromium-review.googlesource.com/c/v8/v8/+/6514659 / v8/v8@f9aac5f

Temporal in V8 is going to require a Rust toolchain.

FWIW, Temporal in V8 is nearing completion: we fail a handful of tests, and there's still some work to do, but it's nearing the point where it might get unflagged.

y-nk commented

how to enable it in the meantime?

targos commented

There's no built-in way to do it. I would suggest to use a polyfill in the meantime.

Temporal is unflagged in V8 today - https://issues.chromium.org/issues/401065166#comment106
Heading for Chrome 144.

y-nk commented

@targos that's what i figured in the end. i went for https://github.com/js-temporal/temporal-polyfill/ which looks like "the official" implementation. thank you for the answer (and sorry for answering back late)