news
Programming Leftovers
-
Sandor Dargo ☛ C++26: Trivial infinite loops are no longer undefined behaviour
Recently, I wrote about how C++26 reduces undefined behaviour, covering changes like erroneous behaviour for uninitialized reads and making incomplete-type deletes ill-formed. I completely forgot about this one. I only realized while preparing for an upcoming CppCon talk on C++26 features — so here it is now.
-
Olaf Alders ☛ git worktree gotchas
A couple of years ago I wrote 4 Strategies for Context Switching in Git, and a lot of the reaction I got was basically “that’s cool — probably not gonna use it”. Something has changed since then, and git worktrees are no longer a niche tool, but they still come with some gotchas.
-
Daniel Lemire ☛ How fast is C++23’s std::flat_map?
C++23 added a new type to the standard library: std::flat_map. There is also a std::flat_set and other variants, but let me focus on std::flat_map.
A flat map is a sorted vector of keys next to a vector of values. A query is a binary search over the sorted keys.
-
Erlang ☛ Erlang/OTP 29.1 Release
Erlang/OTP 29.1 is the firest maintenance patch package for OTP 29, with mostly bug fixes as well as a few improvements.
-
Will Keleher ☛ Small Programming Tricks
Day to day, I think a surprising amount of engineering productivity comes from small nuggets of knowledge: being aware that a language feature exists; knowing that an unexplained tcp delay is probably related to the TCP_NO_DELAY setting and Nagle’s algorithm; knowing the right git incantation to get out of a pickle; or knowing a trick with sed to rewrite a file.
-
Raven ☛ type declaration syntax
most programming languages in common use today are influenced by C in one way or the other. most do not use its syntax for types. C’s type syntax can be quite confusing. it’s not that bad, but it’s definitely not worth imitating. the biggest problem arises with user-defined types, particularly with typedef. without this feature, it is still possible to define structs and unions, but each usage must be prefixed with the keyword struct or union. you cannot declare a variable my_struct a; you must declare it struct my_struct a. but this ceases to be true with typedef, and as a result, the C grammar ceases to be context-free. in order to parse, for instance, the statement foo (*x);, it is necessary to know whether foo is a type or not. this is not ideal at all.
-
Perl / Raku
-
Perl ☛ Dancer2 2.2.0 released; security updates PLEASE READ
We have just released Dancer2 2.2.0. It is a maintenance release containing a number of bug fixes, several important security updates, and one breaking change (see below).
-
-
Python
-
Adam Johnson ☛ Django: serve the change password well-known URL
Password managers that use this URL include Apple’s iCloud Keychain (in Safari since 2019), Google Password Manager (since Chrome 86, 2020), and 1Password. web.dev has an excellent article explaining the specification and showing the Google Password Manager feature in action.
-
LWN ☛ Deterministic testing for multithreaded Python
Python's support for multithreaded programs has improved considerably over the last few years with the advent of the "free-threaded" version of the language. But testing multithreaded programs is notoriously difficult, because the underlying host system determines the thread-execution ordering, which adds an element of non-determinism. At PyCon US, Larry Hastings gave a talk (YouTube video) about his blanket project, which is meant to provide mechanisms for deterministic testing of multithreaded Python code.
He began with a scenario where attendees were working on a new Python library, probably destined for the Python Package Index (PyPI). They had heard about ""this no-GIL thing""—free-threaded Python which does not have a global interpreter lock (GIL)—and wanted to ensure their new library would work in a multithreaded environment. So they look into it and realize that ""all I need to do is add a couple of locks""; he said that would likely suffice in many situations.
-
-
Rust
-
LWN ☛ Stabilizing Rust's never type
A function's return type is supposed to indicate the kind of data that it produces. Rust's "never" type, which is denoted by an exclamation mark ("!"), is the type the language uses to mark a function that never returns and other places where a value can never occur. For a long time, the never type was used internally by the compiler, but was considered an unstable feature. On August 24, after more than two years of work, Rust-compiler-contributor "waffle" finally managed to stabilize the type. It took so long, in part, because it involved a small breaking change to previous Rust editions, which the compiler maintainers needed to ensure did not impact much real code.
(Note: Rust also uses exclamation marks to indicate calls to macros. The way the syntax is constructed, a place where it is valid to use the never type is not a valid place to put a macro invocation and vice versa.)
-
LWN ☛ Typst makes big strides [Ed: Trying to replace LaTeX with something Microsoft more closely controls (Rust)]
Typst is a system for typesetting documents into various formats: PDF, SVG, PNG, and, in progress, HTML. It is adept at handling technical material, and is often considered to be an eventual LaTeX replacement. We last looked in on Typst a year ago, when it had reached version 0.13. A new version, 0.15, was released in June with lots of new features, including support for variable fonts, MathML, multiple bibliographies, and more. Typst is free, Apache-2.0-licensed software, programmed in Rust.
-