Although not in the language yet, I'm excited to see top-level await, pattern matching as well as the null coalesce operator progress and land in the language. Top-level await is already at stage 3, so that is pretty much a shoe in.
Daniel Ehrenberg
@littledan
I'm thrilled with the big stage advancements in this past week's TC39 meeting: - import() and BigInt reached Stage 4 - top-level await and WeakRefs reached Stage 3 - Optional?.Chaining reached Stage 2 - The Emitter proposal was introduced - Several smaller PRs reached consensus
top-level `await` proposal for ECMAScript (stage 3)
ECMAScript proposal: Top-level await
Champion: Myles Borins
Status: Stage 3
Synopsis
Top-level await enables modules to act as big async functions: With top-level await, ECMAScript Modules (ESM) can await resources, causing other modules who import them to wait before they start evaluating their body.
Motivation
Limitations on IIAFEs
With await only available within async functions, a module can include an await in the code that executes at startup by factoring that code into an async function:
There's many proposals potentially related to this one, and other proposals
might mention interaction with this. This file includes casual, example-based
discussion of the proposal, and there's also a document describing the core
semantics in more formal language, which will be iterated over into
the final Spec-ese.
There's also a document including suggestions for other future
proposals, which are dependent on this one, but do
not directly affect the main behavior of the feature.
When performing optional property access in a nested structure in conjunction with the optional chaining operator, it is often desired to provide a default value if the result of that property access is null or undefined. At present, a typical way to express this intent in JavaScript is by using the || operator.
constresponse= {
settings: {
nullValue:null
height:400
animationDuration:0
headerText:''
showSplashScreen:false
}
};
constundefinedValue=response.settings?.undefinedValue||'some other default'; // result: 'some other default'constnullValue=response.settings?.nullValue||'some other default'; // result:
Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
Although not in the language yet, I'm excited to see top-level await, pattern matching as well as the null coalesce operator progress and land in the language. Top-level await is already at stage 3, so that is pretty much a shoe in.
Here's the repos for those interested:
top-level `await` proposal for ECMAScript (stage 3)
ECMAScript proposal: Top-level
awaitChampion: Myles Borins
Status: Stage 3
Synopsis
Top-level
awaitenables modules to act as big async functions: With top-levelawait, ECMAScript Modules (ESM) canawaitresources, causing other modules whoimportthem to wait before they start evaluating their body.Motivation
Limitations on IIAFEs
With
awaitonly available withinasyncfunctions, a module can include anawaitin the code that executes at startup by factoring that code into anasyncfunction:This pattern can also be immediately invoked. You could call this an Immediately Invoked Async Function Expression (IIAFE), as a play on IIFE idiom.
Pattern matching syntax for ECMAScript
ECMAScript Pattern Matching
Status
Stage: 1
Author: Kat Marchán (npm, @maybekatz)
Champions: Brian Terlson (Microsoft, @bterlson), Sebastian Markbåge (Facebook, @sebmarkbage), Kat Marchán (npm, @maybekatz)
Introduction
This proposal adds a pattern matching expression to the language, based on the existing Destructuring Binding Patterns.
There's many proposals potentially related to this one, and other proposals might mention interaction with this. This file includes casual, example-based discussion of the proposal, and there's also a document describing the core semantics in more formal language, which will be iterated over into the final Spec-ese.
There's also a document including suggestions for other future proposals, which are dependent on this one, but do not directly affect the main behavior of the feature.
This proposal was approved for Stage 1 in the May 2018 TC39 meeting, and slides for that presentation are available.
This proposal draws…
Nullish coalescing proposal x ?? y
Nullish Coalescing for JavaScript
Status
Current Stage:
Authors
Overview and motivation
When performing optional property access in a nested structure in conjunction with the optional chaining operator, it is often desired to provide a default value if the result of that property access is
nullorundefined. At present, a typical way to express this intent in JavaScript is by using the||operator.Oh man I didn't know about the pattern matching proposal! I've been waiting for that exact feature in JS ever since I encountered it in Ruby!!! 😍
Pattern matching is one of my favorite features of Standard ML and functional languages. Hopefully they add it to Javacript.
Interesting!
Oooo I hadn't heard of top-level await before. That's awesome!