Programming · Latest articles

30 new today · 2,696 articles · from 79 blogs

Andrew Kelley·

Zig: January 2018 in Review

AI summaryThis January 2018 review of the Zig programming language highlights its readiness for LLVM 6 (with Zig 0.2.0 planned for a week after its release), a friendlier error-handling syntax (try, errdefer, catch), and a new 'error return traces' debugging feature that traces where errors originate at nearly no cost in Debug and ReleaseSafe builds. Additional updates include an automatic documentation generator, the self-hosted compiler now building on Windows and macOS, mandatory explicit function return types, .h file generation for extern declarations, improved C-to-Zig translation, and new standard library crypto functions such as MD5, SHA-1, and integer rotation utilities.

Without Boats·

Async/Await V: Getting back to the futures

AI summaryThe article discusses integrating the self-referential generator API into the futures ecosystem as part of the async/await work. Following a previous proposal and an improved interface suggested by eddyb, the author begins by documenting the generator API that will serve as the starting point for this integration.

Without Boats·

Async/Await IV: An Even Better Proposal

AI summaryThe author unexpectedly revisits the async/await API proposal from their previous post after eddyb demonstrated that immovability can be achieved with a safe interface. They had originally planned for this fourth post in the series to explain transitioning from the generator API to a futures API that avoids heap allocating every async call. Instead, this development changes the direction of the discussion around the proposed API.

Without Boats·

Async/Await III: Moving Forward with Something Shippable

AI summaryThis is the third post in a series on async/await, following earlier discussions of the relationship between generators and self-references, as well as the core problem that must be solved to make generators work. The author had previously rejected several potential solutions as not shippable in the near future. In this post, the author aims to deliver on a promise from the original post by presenting a near-term, shippable solution by the end of the series.

Without Boats·

Async/Await II: Narrowing the Scope of the Problem

AI summaryThis is the second post in a series on async/await, which previously established that generators with references across yield points amount to self-referential structs. The author narrows the discussion to the specific problem that must be solved to make generators work and examines some proposed solutions that they believe are false starts. No concrete proposal is made yet, but one is promised in a future post.

Without Boats·

Async/Await I: Self-Referential Structs

AI summaryThis is the first post in a blog series about generators, async, and await in Rust. The author plans to eventually propose how these features could be brought to stable Rust within the next 12 months while resolving major ergonomics issues in the futures ecosystem. Before presenting that concrete proposal, the series first needs to establish the scope and nature of the problem, beginning with self-referential structs.

Andrew Kelley·

Unsafe Zig is Safer Than Unsafe Rust

AI summaryThe article demonstrates that unsafe Zig is safer than unsafe Rust by comparing equivalent code that reinterprets a byte array as a struct. In Rust, using mem::transmute to cast a misaligned pointer silently produces undefined behavior at the LLVM level due to mismatched alignment, while Zig's compiler rejects the cast outright with an alignment error unless the programmer explicitly declares the correct alignment. The author argues that Zig fully solves alignment issues at compile time, with @alignCast providing a safety-checked escape hatch.

Preshing on Programming··Jeff Preshing

A Flexible Reflection System in C++: Part 2

AI summaryThis article extends a runtime reflection system in C++11 by showing how to add support for new built-in types: primitive types like double are supported by specializing the getPrimitiveDescriptor<>() function template in any .cpp file, while template types like std::unique_ptr<> are handled through a partial specialization of the TypeResolver<> class template that generates a per-specialization type descriptor. It explains how these descriptors work internally, using template constructors and lambda-generated helper functions to handle each instantiation generically. Finally, the author discusses further improvements, such as replacing virtual functions with a table of function pointers (TypeKey) and using a Python script to auto-generate the reflection macros, and notes the system's heavy use in a custom game engine.

Without Boats·

Announcing a new project: configure

AI summaryThe author announces a new project called configure, which aims to provide a uniform way to load configuration variables from a program's environment. The goal is to give libraries a standard mechanism to rely on, so applications can control how configuration is loaded without writing bespoke configuration management glue. The project draws on 'The 12 Factor App' advice about storing configuration in the environment.

Elixir Blog··José Valim

Elixir v1.6 released

Elixir v1.6 includes a code formatter, defguard, dynamic supervision and new module attributes that improves code quality and the developer experience.

Preshing on Programming··Jeff Preshing

A Flexible Reflection System in C++: Part 1

AI summaryThe article presents a small, flexible runtime reflection system for C++11 that uses preprocessor macros and templates to generate TypeDescriptor metadata objects describing the structure of other runtime types. Originally built to support serialization in the author's custom game engine, the system also powers features like 3D rendering and JSON asset importing. Through a compact 242-line GitHub sample project, the author demonstrates how the REFLECT() macros, SFINAE-based type resolution, and the TypeDescriptor class hierarchy work under the hood.

Without Boats·

My Goals for Rust in 2018

AI summaryPrompted by the Rust project's call for community blog posts about goals for 2018, the author shares their own personal objectives for the year. The author, who works on Rust full-time, notes complete agreement with Nick Cameron's post and outlines individual priorities they are motivated to pursue, alongside broader team goals.

Without Boats·

Unsafe Abstractions

AI summaryThe article examines unsafety in Rust not through the familiar lens of primitive operations permitted in unsafe blocks (like dereferencing raw pointers), but from the angle of the capability to produce unsafe abstractions. It defines an unsafe abstraction as a new abstraction that requires the unsafe keyword to apply in some context, noting this definition is intentionally broad because Rust supports several highly divergent forms of unsafe abstraction.

Andrew Kelley·

Zig: December 2017 in Review

AI summaryThis article is a December 2017 progress report for the Zig programming language, detailing major changes such as enum tag types and values, a complete overhaul of enums and unions (enums became simple symbol-to-number mappings while unions gained optional enum tags), and the removal of goto in favor of labeled loops and blocks. It also covers the LLD fork update to 5.0.1rc2, early progress on the self-hosted compiler, a higher-level command-line argument parsing API, improved automatic C-to-Zig translation, and standard library additions like ChildProcess.exec, a FixedBufferAllocator, and a ported block sort implementation with O(1) memory usage. Finally, a new @export builtin allows conditionally exporting functions and creating aliases at compile time.

Without Boats·

Not Explicit

AI summaryThe author describes a recurring argument encountered in Rust community discussions—such as on RFCs and the internals forum—where people reject certain feature designs for being 'too implicit.' These critics typically argue that while 'magic' may be acceptable in other languages, Rust is supposed to be an explicit language, so an alternative design should be preferred instead. The title 'Not Explicit' suggests the author intends to examine or challenge this common notion of explicitness in Rust's design philosophy.

Preshing on Programming··Jeff Preshing

How to Write Your Own C++ Game Engine

AI summaryThe author shares lessons learned from writing a C++ game engine from scratch for their mobile game Hop Out, arguing that modern engine development is more about managing self-created complexity than wrestling with weak hardware. Key advice includes using an iterative approach—getting something running quickly and letting the architecture emerge naturally rather than over-planning—and resisting the urge to unify code too much, such as blindly following DRY or forcing functions into classes. The article also warns that serialization is a bigger subject than many expect.

Without Boats·

Failure 0.1.1 released

AI summaryThe author has released failure 0.1.1 to crates.io, two weeks after the initial release, containing incremental improvements suggested by the community. A major change in this version is that the derive macro can now be used without a separate dependency on the failure_derive crate, requiring only a #[macro_use] tag on the extern crate statement.

Without Boats·

Announcing Failure

AI summaryThe article announces the release of a new Rust crate called 'failure,' now available on crates.io, which is designed to make managing error types easier. The library was heavily influenced by lessons learned from previous error management approaches, particularly the Error trait and the error-chain crate. Its core abstraction is the Fail trait, which serves as a replacement for the existing std::error::Error trait.