编程 · 最新文章

今日新增 29 篇 · 共 2,701 篇 · 来自 79 个博客

Baby Steps·

Thoughts on async closures

AI 摘要The author explores how async closures could work in Rust once static async fn in trait is available. They explain that modeling async closures as closures returning futures would require deep, complicated lifetime handling. Instead, they conclude that async transformers offer a surprisingly natural way to make async closures 'just work'.

Without Boats·

Generators

AI 摘要The author argues that shipping generators would greatly benefit users by simplifying the writing of imperative, iterative code that interacts well with asynchrony and fallibility. They express frustration that generators have been nearly ready for years with little visible progress, especially since the core compiler transform already exists because async functions are implemented using the same generator-to-state-machine mechanism.

Marc Brooker·

Surprising Scalability of Multitenancy

AI 摘要The article argues that short-term peak-to-average traffic ratios, which are often overlooked, are critical to cloud economics because costs scale with peak traffic while generated value scales with average traffic. Multi-tenancy—running many uncorrelated workloads on shared infrastructure—reduces the system-wide peak-to-average ratio, which improves economics and enables impressive per-workload scalability, as illustrated by examples from AWS S3 and Lambda. Since real-world workloads are spiky, autocorrelated, and non-Poisson, mixing diverse uncorrelated workloads is essential to smoothing overall load and achieving these benefits.

React Blog··Joseph Savona, Josh Story, Lauren Tan, Mengdi Chen, Samuel Susla, Sathya Gunasekaran, Sebastian Markbage, and Andrew Clark

React Labs: What We've Been Working On – March 2023

In React Labs posts, we write about projects in active research and development. We've made significant progress on them since our last update, and we'd like to share what we learned.

Without Boats·

The AsyncIterator interface

AI 摘要The article discusses the ongoing debate around Rust's AsyncIterator trait, whose current interface relies on a low-level poll_next method similar to Future::poll. Because poll-style methods are harder to write correctly than async functions, some argue that AsyncIterator should instead expose an async next method, effectively becoming an 'asyncified' version of the Iterator trait. This connects to the author's earlier concept of 'registers'—the idea that Rust code can be written at different levels of abstraction, all of which deserve proper language support.

Josh W. Comeau··Josh W. Comeau

The End of Front-End Development

AI 摘要The article addresses the viral social media narrative that large language models like GPT-4 are advancing so rapidly that software developers will no longer be needed within a couple of years. The author pushes back on this claim, expressing a much more optimistic perspective on what AI advancements mean for the future of software development.

Lea Verou··Lea Verou

Contrast Ratio has a new home — and this is great news!

AI 摘要The author launched contrast-ratio.com over a decade ago as a tool to calculate WCAG 2.1 contrast ratios between CSS colors, addressing flaws in existing tools such as lack of support for semi-transparent colors and non-hex color formats. The site became widely popular, but the author has been too busy with other projects to actively maintain it. Siege Media has now purchased the domain and committed to maintaining the open source project, which the author believes ensures a much brighter future for the tool.

Baby Steps·

Must move types

AI 摘要The author explores the idea of adding 'must move' types to Rust, observing that while the language has many mechanisms to prevent bad practices, it currently has no mechanisms that force good ones. Although they have long resisted this idea because it would add fundamental complexity to the language, they are increasingly encountering problems it could help solve. They aim to sketch what such a feature might look like so the community can better judge whether it is worthwhile.

React Blog··Dan Abramov and Rachel Nabors

Introducing react.dev

Today we are thrilled to launch react.dev, the new home for React and its documentation. In this post, we would like to give you a tour of the new site.

Without Boats·

Const as an auto trait

AI 摘要This article is part of a series on Rust language design, but unlike previous posts that explored high-level concepts like language registers and when to form abstractions, this one focuses entirely on technical details. It discusses the idea of 'const' as an auto trait, using content that was cut from the previous post so that post could stay focused on its broader argument.

Baby Steps·

Temporary lifetimes

AI 摘要The Rust lang team design meeting reviewed the author's document on temporary lifetimes, whose current rules date back to a 2014 blog post. Almost a decade later, these rules have rough edges that are a common source of bugs, and the Rust 2024 Edition provides a chance to address them. The document, which is not a proposal, discusses what works well and what doesn't, along with a few sketchy ideas for improvement.

Without Boats·

Patterns & Abstractions

AI 摘要This post, the second in a series on async Rust design in 2023, discusses 'keyword generics,' a proposal to introduce a new kind of abstraction in Rust that would allow types to be abstracted over certain effects such as async, const, and try. The author draws on two blog posts by the Rust design team as reference points and observes that the effects considered by the keyword generics working group overlap with, but are not identical to, the effects identified in the author's previous post.

Baby Steps·

To async trait or just to trait

AI 摘要The article examines whether traits containing async functions should be explicitly labeled as 'async traits' as opposed to ordinary sync traits. While the author initially saw no need for the distinction and later considered potential advantages for supporting 'maybe async' code, further reflection led them to conclude that introducing this distinction should not be done, at least for now.

Svelte Blog·

Zero-effort type safety

AI 摘要SvelteKit now offers 'zero-effort type safety,' where the framework automatically infers and injects types for load functions, route parameters, and data props based on its file-system routing conventions, eliminating the need for explicit annotations. This works through changes to the Svelte language server and TypeScript plugin, which auto-insert the generated types from virtual $types.d.ts files, and is available via the latest Svelte VS Code extension, other LSP-compatible editors, and svelte-check 3.1.1+. Beyond convenience, the feature improves correctness by preventing mix-ups between similar event types, and the team plans to extend type safety to areas like links in the future.