New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

Security News

TC39 Advances 3 Proposals to Stage 4: RegExp Escaping, Float16Array, and Redeclarable global eval vars

TC39 met in Seattle and advanced 9 JavaScript proposals, including three to Stage 4, introducing new features and enhancements for a future ECMAScript release.

TC39 Advances 3 Proposals to Stage 4: RegExp Escaping, Float16Array, and Redeclarable global eval vars

Sarah Gooding

February 20, 2025


The TC39 committee, the driving force behind the evolution of JavaScript, is wrapping up an exciting week of meetings in Seattle with some major advancements for the language. Thanks to live updates from TC39 co-chair Rob Palmer, we now know that nine proposals have been advanced to various next stages during the committee’s 106th meeting.

Notable among the proposals that were advanced include three that are moving to Stage 4, meaning they are ready to become part of the ECMAScript standard. These include RegExp Escaping, Float16Array, and Redeclarable global eval vars. Other proposals, including Math.clamp, Immutable ArrayBuffer, and enhancements to error handling and module imports, have also made progress to the next stages.

Here’s a closer look at each of the nine proposals and what they could mean for JavaScript developers.

Curtailing the power of "Thenables"#

The "Thenable Curtailment" proposal is advancing to Stage 1. It aims to address issues arising from objects with a then method, known as "thenables," which can interfere with JavaScript's Promise behavior. These objects can lead to unexpected interactions, especially with module namespace objects during dynamic imports. The proposal suggests mechanisms to limit the influence of thenables, ensuring more predictable and reliable promise operations.

Error.captureStackTrace#

The Error.captureStackTrace proposal advanced to Stage 1 this week. It aims to standardize the Error.captureStackTrace method across JavaScript environments. Currently a non-standard feature in V8 (used by Chrome and Node.js), this method allows developers to create custom error objects with a stack property that captures the point in the code where the error was instantiated. Standardizing this method would enhance cross-platform consistency and improve error handling in JavaScript applications.

Error Stack Accessor#

Error.prototype.stack is advancing to Stage 2. This proposal aims to standardize the Error.prototype.stack property across JavaScript environments. Currently, while many JavaScript engines provide a stack property on error objects, its implementation is inconsistent and not part of the official ECMAScript specification. This proposal seeks to define a standard accessor for error stack traces, enhancing cross-platform consistency and improving error handling in JavaScript applications.

Float16Array#

The Float16Array proposal has reached Stage 4 in the TC39 process. It introduces a new typed array to handle 16-bit floating-point numbers (float16) in JavaScript. This addition would complement existing typed arrays like Float32Array and Float64Array, providing a more memory-efficient option for applications where full 32-bit or 64-bit precision isn't necessary. The proposal also includes new DataView methods—getFloat16 and setFloat16—for reading and writing 16-bit floats, as well as a Math.f16round function for rounding to the nearest float16 value. This enhancement is particularly beneficial for GPU operations and other performance-critical applications that can leverage half-precision floating-point arithmetic.

Immutable ArrayBuffer#

The Immutable ArrayBuffer proposal, which advanced to Stage 2.7 at this week's TC39 meeting, introduces a read-only variant of ArrayBuffer. Once created, its contents cannot be modified, resized, or detached. This immutability can improve performance by avoiding unnecessary data copying and is particularly useful for embedding fixed data in environments with memory constraints.

import defer#

Previously known as "Lazy Module Initialization," the import defer proposal advanced to Stage 3 this week. It introduces a new import defer syntax in JavaScript. This feature allows developers to load modules without immediately executing them, deferring their evaluation until their exports are accessed. This approach can enhance application startup performance by reducing unnecessary initial computations. However, modules utilizing top-level await are not compatible with deferred evaluation, as their execution cannot be postponed.

Math.clamp#

The Math.clamp proposal, which advanced to Stage 1 at this week's TC39 meeting, aims to introduce a Math.clamp function in JavaScript. This function would constrain a number within a specified range, returning the lower bound if the number is below it, the upper bound if above, or the number itself if within the range. This addition seeks to enhance code readability and reduce the need for custom clamping functions in various projects.

Redeclarable global eval vars#

The Redeclarable Global eval Variables proposal, which advanced to Stage 4, simplifies JavaScript's handling of global variables introduced via eval. Currently, variables declared with var inside a global eval are configurable properties, yet redeclaring them using let or const results in an error. This proposal seeks to allow such redeclarations, streamlining the language's behavior and reducing complexity for developers.

RegExp Escaping#

The RegExp Escaping proposal successfully advanced to Stage 4, introducing a RegExp.escape function to JavaScript. This function allows developers to escape special characters in strings, enabling their safe incorporation into regular expressions without unintended interpretations. The need for such functionality has been recognized in the JavaScript community for years. Notably, in 2006, Simon Willison highlighted this gap and shared a custom implementation on his blog. The standardization of RegExp.escape addresses this longstanding issue, providing a reliable, built-in method for developers.

In addition to the proposals advancing stages, the recent TC39 meeting in Seattle also featured discussions on several significant topics without stage advancement. These included:

  • Decimal & Measure
  • Decorators
  • Explicit Resource Management
  • Intl Locale Info API
  • Limited ArrayBuffer
  • Records & Tuples
  • ShadowRealm
  • Stabilize Integrity Traits
  • Stable Formatting
  • Temporal

While these features did not see formal advancement, their continued discussion highlights ongoing areas of interest and potential future enhancements for JavaScript. Check out the full agenda for more information on the discussions.

Subscribe to our newsletter

Get notified when we publish new security blog posts!

Try it now

Ready to block malicious and vulnerable dependencies?

Install GitHub AppBook a demo

Related posts

Back to all posts
SocketSocket SOC 2 Logo

Product

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc