Get a catch block error message with TypeScript
TypeScript forces you to acknowledge you can't know what was thrown making getting the error message a pain. Here's how you can manage it.
今日新增 417 篇 · 共 7,410 篇 · 来自 241 个博客
TypeScript forces you to acknowledge you can't know what was thrown making getting the error message a pain. Here's how you can manage it.
A history of our metaphorical understanding of the web
AI 摘要The article explains how UX designers can sell the need for user research by getting stakeholders to collaboratively answer two simple questions—'What are the objects?' and 'What are the relationships between those objects?'—drawn from the first two steps of the ORCA (Objects, Relationships, CTAs, Attributes) process in Object-Oriented UX. When stakeholders themselves debate specific questions and expose gaps in their shared understanding during an Object Definition Workshop, they become motivated to support user research rather than resist it. The author also describes the prep work of 'noun foraging'—collecting domain-specific nouns from sources like marketing sites, existing products, and interview transcripts—and testing them with the SIP criteria (Structure, Instances, Purpose).
AI 摘要The author presents a toy simulator for exploring the latency effects of serial, parallel, and quorum approaches to distributed operations, with configurable parameters for chain length, parallel chains, quorum size, and number of runs. Examples show that a 3-of-5 Paxos-style quorum can dramatically reduce tail latency compared to a length-3 chain replication system (dropping the 99th percentile from around 8s to just over 2ms), while larger quorums like 4-of-7 offer further high-percentile improvements. The simulator also reveals non-linear growth in latency for longer serial chains, inviting readers to experiment with the knobs.
How Unsplash's blurred image loading works and why I did mine differently for a more excellent experience on my site.
Write before you're ready, write for yourself, quantity over quality, and a few other lessons.
AI 摘要In this follow-up to his previous post on dyn async traits, the author shares a better approach to 'roll your own' boxed dyn traits, suggested by dtolnay: instead of constructing a vtable struct of function pointers, one creates a 'shadow trait' that mirrors the vtable's contents, similar to the technique used by the erased-serde crate. He also sketches out a crate he would like to see built for experimenting with this approach.
AI 摘要The article explores strategies for providing default values for CSS custom properties when building customizable components with a CSS API, noting that setting defaults directly breaks inheritance and repeating fallback parameters is verbose. The author's preferred approach is 'pseudo-private custom properties,' where an internal property (e.g., --_color) is set to the exposed property with a fallback, while alternatives include using a fallback variable or @property registration—the latter being Chromium-only, global, and prone to silent conflicts. The article also showcases a pure-CSS checkbox switch built with the pseudo-private technique, which doubles as self-documentation of the component's custom property API.
AI 摘要On nightly Rust, async functions in traits can already be modeled with GATs and impl Trait, as done by the Embassy runtime and the real-async-trait crate, but this approach does not support dynamic dispatch. The author has been exploring why this limitation exists and what language primitives would need to be exposed to overcome it, and still favors stabilizing those primitives to enable experimentation. However, they realized that procedural macros could almost enable this experimentation today, though it falls short due to some obscure Rust type system rules that they have long wanted to change.
AI 摘要The next Cross Team Collaboration Fun Times (CTCFT) meeting will take place on 2021-10-18, with a theme focused on empowering and organizing contributors. The agenda includes opening remarks, a CTCFT update, a session on sprints implementing the async vision doc, a rust-analyzer talk, and an introduction to a contributor survey. Afterwards, an experimental social hour will be held with breakout rooms coordinated via the rust-lang Zulip.
Remix has this beautifully simple feature for CSS that I want to tell you all about.
AI 摘要The article argues that the defining architectural flaw of Western social media incumbents is conflating the social graph with the content feed, forcing users to build a network of follows just to populate their feeds. This design produces negative network effects at scale—such as context collapse, diminishing entertainment value, and path-dependent outcomes like Pinterest's early skew toward female users—and because users rarely unfollow people, these graph choices act as nearly irreversible 'one-way decisions.' The author suggests the next wave of social startups should treat graph design with great care and consider alternatives, such as algorithmically deriving an interest graph, rather than copying incumbent patterns out of survivor bias.
AI 摘要This article is the fourth part of a series exploring dynamic dispatch for async traits in Rust. Building on a previous post about implementing Iterator for dyn Iterator using new primitives, the author examines what core capabilities would be required to extend the same approach to async iterator traits. The article also discusses that calling an async fn through a dyn trait requires the return type to be a Box, but only in the dyn context rather than universally.
AI 摘要This post continues a series on 'dyn async traits' in Rust, building on the idea that the compiler can be viewed as synthesizing an impl that performs dynamic dispatch. The author explores a theoretical future in which Rust programmers could manually write this 'impl Trait for dyn Trait' themselves. Though partly a thought exercise, giving programmers such control could enable many new use cases and may inform a future language design.