Logo

    801: 6 New JavaScript Proposals

    enJuly 29, 2024
    What are the stages of JavaScript proposal development?
    How does deferred evaluation benefit JavaScript module loading?
    What is the purpose of the Shadow Realm feature?
    How can developers create new iterators in JavaScript?
    What is the significance of Stage 5 in the proposal process?

    Podcast Summary

    • JavaScript ProposalsSix new JavaScript proposals are in the works, each going through the stages of Strawman Proposal, Proposal, Draft, Candidate, Proposed Standard, and Standard to potentially change the way we develop and use JavaScript.

      There are six exciting new JavaScript proposals currently in the works, each at various stages of the proposal process. These upcoming features could potentially change the way we develop and use JavaScript in the future. Here's a brief overview of the stages involved in getting a proposal added to ECMAScript, as mentioned by Scott and Wes: 1. **Stage 0: Strawman Proposal**: This is the initial stage where an idea is proposed and discussed within the community. 2. **Stage 1: Proposal**: If the idea gains traction, it moves to this stage, where a formal specification is drafted and a proposal is made to the ECMA International standards body. 3. **Stage 2: Draft**: Once the proposal is accepted, it becomes a draft and undergoes further refinement and review. 4. **Stage 3: Candidate**: If the draft is approved, it becomes a candidate recommendation and is implemented in various browsers for testing and feedback. 5. **Stage 4: Proposed Standard**: After successful implementation and testing, the feature is proposed as a standard. 6. **Stage 5: Standard**: Once finalized, the feature becomes a part of the ECMAScript standard. By staying informed about these proposals, developers can prepare for upcoming changes, learn new features ahead of time, and even contribute to the discussion and development process.

    • TC39 feature processTC39 evaluates and tests new JavaScript features through a five-stage process before adding them to the language, ensuring developer experience improvements without revolutionary changes

      TC39 is the committee responsible for deciding which core language features to add to JavaScript. They don't handle web APIs, such as fetch or web workers. The process of adding a new feature involves five stages. At stage zero, anyone can propose a feature, and it's under consideration. In stage one, the proposal is discussed, and initial ideas are explored. In stage two, a preferred solution is chosen, but it's still being evaluated. In stage 2.7, the API design is finalized, and the feature is close to implementation. At stage three, the feature has been recommended for implementation and is likely to be added to the language. The feature may still be clawed back at this stage. Finally, at stage four, the feature is officially part of the JavaScript language. One example of a feature currently in the process is promise.try. This is not a groundbreaking addition, but it provides useful enhancements to the promise API. The promise API continues to evolve, with new features being added to make JavaScript development more convenient. While these additions may not be revolutionary, they can significantly improve the developer experience. The TC39 process ensures that new features are thoroughly evaluated and tested before being added to the language.

    • Promise.try, Precise mathPromise.try is a new proposal that simplifies awaiting, handling errors, and chaining functions for non-promises, while Precise math is a proposal that aims to improve JavaScript's math functions' accuracy. Both proposals can significantly enhance the language, with Promise.try being more accessible and Precise math adding an extra layer of cost.

      The JavaScript community is continuously exploring ways to enhance the language through new proposals, and one such proposal is the 'Promise.try' API. This API allows developers to await, handle errors, and chain functions that may or may not return promises. It's currently in the stage three proposal process and can be a game-changer for managing non-promise functions. Another interesting proposal is 'precise math.' JavaScript's math functions can sometimes lack precision, especially when dealing with large numbers or decimal points. The 'precise' proposal aims to address this issue by providing more accurate results. This proposal adds an extra layer of cost to the operation, signaling to developers that this is a more computationally intensive process. During the discussion, it was mentioned that developers could achieve similar results using existing methods like 'promise.resolve' or 'dot catch API.' However, the 'Promise.try' API simplifies the process and makes it more accessible. These proposals showcase the JavaScript community's dedication to improving the language and addressing common pain points. Keep an eye on these proposals as they progress through the stages and potentially become part of the JavaScript standard.

    • Floating point math precisionFloating point math in JavaScript may result in unexpected precision loss, causing inaccurate calculations. Use libraries or built-in functions for more precise decimal arithmetic.

      When performing mathematical operations in JavaScript, especially those involving decimals or floating point numbers, the results may not be as precise as we expect due to the way floating point math is implemented at the CPU level. This can lead to unexpected results when adding or subtracting numbers, such as 0.1 + 0.2 not equaling 0.2. To illustrate this, one can try writing a code snippet where the window location is set to the sum of two decimal numbers, leading to an error or unexpected result. The term "float" in floating point numbers refers to the decimal point being able to "float" to different positions within the number representation, allowing for a wide range of values to be represented using a fixed number of bits. However, this comes with the trade-off of potential loss of precision during calculations. To avoid such issues, it's recommended to use libraries or built-in functions that provide more precise decimal arithmetic in JavaScript.

    • Shadow RealmShadow Realm is a new concept in JavaScript Stage 2.7 that allows developers to create isolated execution contexts, preventing conflicts and enabling DOM virtualization for improved performance and efficient data handling.

      JavaScript's Stage 2.7 introduces a new concept called Shadow Realm, which allows developers to create their own JavaScript execution context that is isolated from the global scope. This can be particularly useful when importing third-party code or testing code, as it prevents potential conflicts caused by variables with the same name. Shadow Realm also enables DOM virtualization, allowing developers to keep their data within the regular JavaScript DOM API without the need for additional contexts like web workers. This can lead to improved performance and more efficient data handling. While not a daily necessity for all developers, Shadow Realm is an exciting new feature for those working on tooling and large-scale projects. It's like having your own private sandbox within the larger JavaScript ecosystem, giving you more control and flexibility over your code.

    • Tools for Enhancing Web DevelopmentShadow DOM isolates components and their styles, making debugging easier, while Proposal Rejects Escape simplifies regex handling and deferred module evaluation improves performance.

      Both Shadow DOM and Proposal Rejects Escape are valuable tools for enhancing web development. Shadow DOM, often compared to a hedgehog due to its ability to create new scopes and contexts, is crucial for managing complex applications by isolating components and their styles, making debugging easier. On the other hand, Proposal Rejects Escape simplifies the process of working with regular expressions by automatically escaping special characters within them, saving time and reducing potential errors. Moreover, utilizing Century.io's syntax tool is essential for gaining visibility into potential issues in applications. It provides a platform to view errors and warnings, ensuring that developers maintain control over their projects and can promptly address any problems that arise. Deferred module evaluation, also known as lazy module initialization, is an intriguing development that can significantly improve performance in web applications. By only loading modules when they are needed, developers can reduce the initial load time of their applications and improve the overall user experience. In summary, these tools and techniques provide developers with enhanced capabilities, streamlined processes, and improved performance, making them essential components of modern web development. By embracing these advancements, developers can create more efficient, effective, and high-quality applications.

    • Deferred evaluation, Iterator sequencingDeferred evaluation allows developers to mark imports as non-executing until they are actually needed, preventing unwanted side effects and unnecessary computations. Iterator sequencing enables the creation of new iterators by sequencing existing ones, providing more complex and custom data handling.

      JavaScript's module loading process can execute code as soon as a module is required. This can lead to unwanted side effects or unnecessary computations. To prevent this, developers can use deferred evaluation, which allows them to mark imports as non-executing until they are actually needed. This provides more control over when code is executed. Another topic discussed was iterator sequencing, a proposal that allows the creation of new iterators by sequencing existing ones. Iterators are a type of collection in JavaScript, including arrays, maps, sets, and node lists. By sequencing iterators, developers can create more complex and custom data handling. Understanding these concepts can lead to more efficient and effective use of JavaScript.

    • JavaScript Iterator enhancementsNew helper methods and capabilities in JavaScript Iterators, such as .next API and Iterator sequencing, offer more efficient and powerful ways to handle data in the next six months

      Iterators in JavaScript have been evolving with new helper methods and capabilities, allowing developers to work with them more efficiently without converting them to arrays first. These enhancements include the ability to use .next API inside iterators, which can also indicate when an iterator is finished and return a value. Iterator sequencing is a new feature currently in stage two, enabling multiple iterators to be concatenated into a single long iterator, similar to combining arrays. These advancements are expected to be widely adopted in the next six months, offering more streamlined and powerful ways to handle data in JavaScript.

    Recent Episodes from Syntax - Tasty Web Development Treats

    817: You Need These 30 Apps - PART 1

    817: You Need These 30 Apps - PART 1

    Scott and Wes kick off part 1 of a 2-part series, breaking down 30 must-have apps for web developers and productivity enthusiasts. From file management tools to media utilities, they cover everything you need to supercharge your workflow.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    816: Why Your CSS Sucks

    816: Why Your CSS Sucks

    Scott and Wes break down why your CSS might suck—from misusing specificity to not leveraging CSS variables. Tune in as they dive into common pitfalls that are making your stylesheets a hot mess.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    815: Deno 2 with Ryan Dahl

    815: Deno 2 with Ryan Dahl

    In this episode of Syntax, Wes and Scott talk with Ryan Dahl about Deno 2.0, its new features and use of web standards, and how it seamlessly integrates with popular frameworks like Next.js. Ryan shares insights on the motivations behind Deno’s creation, its emphasis on simplicity and security, and offers his take on the evolving JavaScript ecosystem.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    814: Fundamentals: HTML

    814: Fundamentals: HTML

    In this episode of Syntax, Wes and Scott talk about HTML fundamentals — from basic structure and semantics to practical tips for better accessibility and SEO. They also discuss the difference between block and inline elements, form functionalities, HTML5 elements like dialog and canvas, and more.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    813: CSS: Scroll Driven Animations

    813: CSS: Scroll Driven Animations

    In this episode of Syntax, Wes and Scott talk about CSS’ new scroll-driven animations, its implementation, uses, and potential pitfalls. They also discuss animation-timeline and animation-range, and how they can be utilized to control animations based on scroll positions.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    812: CSS 4, 5, and 6! With Google’s Una and Adam

    812: CSS 4, 5, and 6! With Google’s Una and Adam

    In this episode of Syntax, Wes and Scott talk with Una Kravetz and Adam Argyle from Google Chrome about the evolution of CSS, new features, and the push toward more advanced UI capabilities on the web. They discuss the introduction of CSS versioning, exciting new properties like text-box-trim, state queries, and scroll state functionalities, select, and more!

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    How To Stay Up To Date with Daily.dev’s Francesco Ciulla

    How To Stay Up To Date with Daily.dev’s Francesco Ciulla

    In this episode of Syntax, Scott and Wes talk with Daily.dev’s Francesco Ciulla about the platform's history, community features, and significant growth. They dive into the core ideas behind daily.dev, including its personalized feed for developers, new features like squads, community contributions, and tech stack. Francesco also shares his passion for Rust, and highlights the importance of content creation in the ever-evolving tech landscape.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    808: The Future of JavaScript Frameworks × Building Auth × DB Design Tips, and more!

    808: The Future of JavaScript Frameworks × Building Auth × DB Design Tips, and more!

    In this potluck episode of Syntax, Wes and Scott answer your questions about the future of JavaScript frameworks, building custom authentication systems, limiting API access, using Caddy server proxy for local development, component props in JSX, structuring a relational database, and more!

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads