Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 15 submissions in the queue.
posted by janrinok on Wednesday July 05 2023, @07:10AM   Printer-friendly

ECMAScript 2023 spec for JavaScript finalized:

ECMAScript 2023, an update to the official specification for the JavaScript programming language, has been approved by ECMA International. The new spec adds new methods for searching and changing arrays, extends the WeakMap API to allow unique symbols, and introduces some standardization for the use of hashbangs.

Approved on June 27, the ECMAScript 2023 specification cites the following synopsis of improvements:

ECMAScript 2023, the 14th edition, introduced the toSorted, toReversed, with, findLast, and findLastIndex methods on Array.prototype and TypedArray.prototype, as well as the toSpliced method on Array.prototype; added support for #! comments at the beginning of files to better facilitate executable ECMAScript files; and allowed the use of most Symbols as keys in weak collections.

The finished proposals, published by the ECMA TC39 (Technical Committee 39) on GitHub, elaborate on the four features to be published this year:

  • Array find from last, a proposal for .findlast() and .findLastIndex() methods on array and typed array. Finding an element in an array is a very common programming pattern, the proposal states. Scenarios under which this feature would be used include when a developer knows that finding an element from last to first may have better performance, or developers care about the order of the elements.
  • Permitting symbols as keys in WeakMap keys, a proposal that extends the WeakMap API to allow the use of unique symbols as keys. Currently, WeakMaps are limited to allow only objects as keys.
  • Change array by copy, a proposal that provides additional methods on Array.prototype and TypedArray.prototype to enable changes on the array by returning a new copy of it with the change.
  • Hashbang grammar, a proposal to match the de facto usage in some CLI JS hosts that allow for Shebangs/Hashbang. These hosts strip the hashbang to generate valid JS source texts before passing to JS engines. This plan would move the stripping to engines and unify and standardize how that is done.

Updated versions of ECMAScript traditionally are finalized by ECMA in June. Last year's ECMAScript 2022 featured class elements and top-level await capabilities.


Original Submission

 
This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 0) by Anonymous Coward on Wednesday July 05 2023, @08:38AM (4 children)

    by Anonymous Coward on Wednesday July 05 2023, @08:38AM (#1314498)

    I don't think I have ever used find() or findIndex().

  • (Score: 2) by janrinok on Wednesday July 05 2023, @08:41AM

    by janrinok (52) Subscriber Badge on Wednesday July 05 2023, @08:41AM (#1314499) Journal

    Perhaps not, but others might have done so.

  • (Score: 3, Touché) by GloomMower on Wednesday July 05 2023, @03:35PM (2 children)

    by GloomMower (17961) on Wednesday July 05 2023, @03:35PM (#1314562)

    You just do your own loop then?

    • (Score: 2) by bussdriver on Wednesday July 05 2023, @03:42PM (1 child)

      by bussdriver (6876) Subscriber Badge on Wednesday July 05 2023, @03:42PM (#1314564)

      people who can't handle doing the loop ... well, it's supposed to be accessible to as many people as possible so i guess this is ok. but classes and other complex bloat shouldn't be allowed. I think they should require 5 years between changes! We are not supposed to be building large complex projects in this scripting language. it should be the glue it was intended to be.

      • (Score: 2) by GloomMower on Wednesday July 05 2023, @09:51PM

        by GloomMower (17961) on Wednesday July 05 2023, @09:51PM (#1314629)

        > We are not supposed to be building large complex projects in this scripting language.

        It really grinded my gears in the early 2000s, but I don't mind it so much anymore.

        Kind of have to face reality. Though if you really don't like it, you can do a lot now with web assembly.