jint icon indicating copy to clipboard operation
jint copied to clipboard

Temporal API

Open Ghostbird opened this issue 11 months ago • 5 comments

Given that Temporal is as stage 3 proposal now, and ECMAScript engine implementers are currently working to implement it[^1]. It would be very nice if we could work on that in Jint too.

[^1]: > … SpiderMonkey passes 96% of the tests. V8 and LibJS three quarters. JavaScriptCore 40%, and Boa is at 23% and they have either landed since the time that I wrote this slide or are still about to land a change that would get them to 32%. … 103rd TC39 Meeting | 30th July 2024 # Temporal update & bug fixes

As a starting point here's a Markdown Temporal API to do list template

Ghostbird avatar Jan 02 '25 11:01 Ghostbird

That's a huge undertaking. Would you like to start implementing it incrementally? The https://github.com/tc39/test262 suite already has test cases for Temporal and they can be enabled by editing https://github.com/sebastienros/jint/blob/main/Jint.Tests.Test262/Test262Harness.settings.json and re-generating the test suite.

lahma avatar Jan 02 '25 12:01 lahma

Ah, that's very nice! I'll have a look. I can't promise that I can sink many hours into this, but we'll need to start somewhere.

Ghostbird avatar Jan 02 '25 12:01 Ghostbird

https://developer.mozilla.org/en-US/blog/javascript-temporal-is-coming/

sebastienros avatar Jan 30 '25 16:01 sebastienros

Thanks! I'm sorry I haven't managed to give this more time yet. I'm not too familiar with Jint yet. Do you think it is feasible to ship @js-temporal/polyfill and let users optionally enable it? Or would that be completely ridiculous in Jint's situation? As I understand it, polyfills only patch things that are missing, so we could slowly add the C# implementation and the polyfill would do less-and-less work, until it could be removed.

I think that would be one of the first things I'd like to try, load the polyfill and see what the consequences are.

Ghostbird avatar Feb 05 '25 13:02 Ghostbird

Anyone can import the polyfills they need, I don't see a reason for jint to ship them. Downside with polyfills is that they perform a lot worse as they are interpreted instead of being native NET code.

lahma avatar Feb 05 '25 15:02 lahma

Polyfiling Temporal in Jint currently seems to require first polyfilling Intl API support in Jint. So I think we should at least postpone this issue until Jint has Intl support.

Ghostbird avatar Apr 03 '25 08:04 Ghostbird

Related to this, I ran intl402 test out of curiosity to check the % of tests passing. Cannot run them with the text explorer. Takes forever and eventual memory exhaustion error pops. This is on a pretty decent machine. Lots of tests where added here so I did not dig further. Tried also "Parallel:false" in the settigs in case it was something thread related. No better.

Problem happens when ran all at once. One by one they seem to work.

I can open an issue if that is helpful. Just for the team's info.

LuisMerinoP avatar Apr 20 '25 17:04 LuisMerinoP