
Trong Elixir, các hàm guard như is_map_key/2 khi thất bại (không trả về false mà gây lỗi) sẽ khiến toàn bộ biểu thức guard thất bại, bỏ qua đánh giá ngắn mạch của or sau đó. Do đó, a or b và b or a trong guard không tương đương khi a có thể gây lỗi, phá vỡ tính giao hoán mong đợi. Tính đến Elixir 1.20.1 / OTP 29, trình biên dịch không cảnh báo cho mẫu này.
Vì sao nên đọc: Một lập trình viên nên đọc bài này để tránh lỗi không mong đợi khi điều kiện or trong guard của Elixir không hoạt động như kỳ vọng, đặc biệt khi một guard trả về lỗi thay vì false, khiến kết quả phụ thuộc vào thứ tự biểu thị.
Nguồn: https://hauleth.dev/post/guards-guards. 8sync News chỉ tóm tắt và dẫn link; bản quyền nội dung thuộc tác giả và nguồn gốc.
Một nhà phát triển hài hước kể lại hành trình khám phá các ngôn ngữ lập trình — từ LISP, COBOL, Perl, Python, Ruby, Java, JavaScript, Go đến Rust — ghi lại những đặc điểm kỳ quặc và khó chịu của từng ngôn ngữ trước khi tìm thấy sự hài lòng với Elixir và hệ sinh thái BEAM.
Làm việc với nhiều ngôn ngữ lập trình khác nhau giúp bạn hiểu rõ hơn về cách mỗi ngôn ngữ xử lý vấn đề, từ đó có thể chọn lựa và áp dụng hiệu quả hơn trong công việc thực tế.
SW Mansion collaborated with Supabase on two parallel engineering efforts: modernizing the Realtime.js SDK by migrating from a custom Phoenix.js fork to the canonical upstream library, and improving Logflare, Supabase's observability platform. The Realtime.js work involved building a proof of concept, creating an abstraction layer to preserve the existing API, developing a browser-based test playground, and adding React Native lifecycle hooks for reliable WebSocket reconnection. On the Logflare side, the team migrated BigQuery integration from a deprecated REST API to gRPC streaming, rebuilt the ingestion rule evaluation engine as a tree-based structure for near-logarithmic complexity, and implemented export adapters for Axiom, Last9, and OpenTelemetry Protocol.
Phoenix LiveView mounts twice on first page load — once for the static HTTP dead render and again when the WebSocket connects. The common fix of guarding data loads with connected?/1 avoids double queries but breaks SEO, link previews, and no-JS fallback by leaving the dead render empty. This post explains why the double mount exists, what connected?/1 actually costs, and introduces an experimental fork that parks the dead-render socket in a short-lived GenServer and redeems it on WebSocket connect — skipping the second mount entirely. The fork adds an on_connect/1 callback for connection-only side effects (subscriptions, timers, presence) and provides migration patterns for data loads, connect params, and real-time data. The upstream Phoenix team is working on a more complete 'adoptable LiveViews' solution (issue #3551), but this fork serves as an interim stopgap.

Elixir v1.20.2 is a patch release with one enhancement and multiple bug fixes. The enhancement adds per-module type checking times to compiler profiling output. Bug fixes address binary comprehensions with size options, compiler error messages for quote/unquote in patterns and guards, restoration of a Kernel.put_elem/3 compiler optimization, and numerous type system fixes covering empty function types, bitstring patterns, map/optional key operations, list types, protocol implementations, and struct redefinition errors. Mix also receives fixes for unnecessary umbrella recompilation and dependency recompilation on compile-time environment changes.