Constructors Shouldn't Throw
Constructors in programming should not throw exceptions, as it can lead to unpredictable object states. Instead, constructors should handle errors gracefully, promoting safer and more reliable code. (t3.at)
This describes RESONANCE, a custom Wayland compositor built to occupy a middle ground between floating and tiling window managers. Rather than letting windows pile up or forcing everything into a rigid grid, windows live on stacked "levels" (Basement, Ground, First, Second) that visually inset to convey depth; new windows map to Ground and are demoted upward if they overlap, promoted back down when space frees, and never force already-open windows to move. The compositor started from tinywl and grew into a full-featured system that handles multi-monitor layout, XWayland, layer-shell, server-side decorations, screen capture, pointer constraints, drag-and-drop, and an IPC port. Crucially, policy and placement live in a separate Python "brain" process communicating over a simple newline-delimited socket: the compositor reports events and accepts two commands (place and fullscreen), so window-decision logic can be edited and restarted mid-session without destabilizing the C compositor.
Key specifics include a persistent three-axis placement store (app_id → floor → per-window slots) with rules for when a geometry is recorded, monitor-aware replay, special handling for splashes and generic GTK dialogs, and fullscreen restoration semantics. A push-resize model prevents overlap by sliding at-most-one neighbor per axis with a 7 px gap and a 100 px minimum, recalculated live from committed frames; pushes do not chain and persist once applied. The separation of policy and execution, plus the spatial level model, yields a stable, readable workspace that avoids both chaotic stacking and intrusive automatic tiling.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.
Constructors in programming should not throw exceptions, as it can lead to unpredictable object states. Instead, constructors should handle errors gracefully, promoting safer and more reliable code. (t3.at)
OmniPTY is an opinionated terminal emulator for macOS and Linux that features splits, workspaces, a file tree, and an integrated prompt. It is GPU-rendered and written in Rust. (github.com)
Building personal software factories is a waste of time for most developers, as AI tools can accomplish similar goals more efficiently. Instead, focus on learning how AI models work and applying automation to work-related systems for tangible benefits. (peterp.me)
The Free Pascal Compiler and Lazarus IDE now support dynamic packages, enabling quick creation and installation of components and plugins without rebuilding the IDE. This feature enhances flexibility by allowing programs to use replaceable plugins and modules, with some restrictions on unit names and package size. (getlazarus.org)
Mitos is a fork of Helix, a modal text editor with features like multi-cursor editing, syntax awareness, and built-in language tooling. It supports Rust development, debugging, image previews, and file navigation, and is open source under MPL-2.0. (mitos.computer)
Java 17's sealed classes allow explicit listing of permitted subtypes, enabling exhaustive pattern matching without default clauses. Adding new subtypes is a breaking change that requires recompiling consumers to avoid runtime errors. (neilmadden.blog)
Today's best Hacker News stories, summarized and screenshotted, one email a day.