In a high-level language, the programmer is deprived of the dangerous power to update his own
program while it is running. Even more valuable, he has the power to split his machine into a
number of separate variables, arrays, files, etc.; when he wishes to update any of these he must
quote its name explicitly on the left of the assignment, so that the identity of the part of the
machine subject to change is immediately apparent; and, finally, a high-level language can
guarantee that all variables are disjoint, and that updating any one of them cannot possibly have
any effect on any other.
Unfortunately, many of these advantages are not maintained in the design of procedures and
parameters in ALGOL 60 and other languages. But instead of mending these minor faults, many
language designers have preferred to extend them throughout the whole language by introducing the
concept of reference, pointer, or indirect address into the language as an assignable item of
data. This immediately gives rise in a high-level language to one of the most notorious confusions
of machine code, namely that between an address and its contents. Some languages attempt to solve
this by even more confusing automatic coercion rules. Worst still, an indirect assignment through
a pointer, just as in machine code, can update any store location whatsoever, and the damage is no
longer confined to the variable explicitly named as the target of assignment…
Unlike all other values (integers, strings, arrays, files, etc.) references have no meaning
independent of a particular run of a program. They cannot be input as data, and they cannot be
output as results. If either data or references to data have to be stored on files or backing
stores, the problems are immense. And on many machines they have a surprising overhead on
performance, for example they will clog up instruction pipelines, data lookahead, slave stores,
and even paging systems. References are like jumps, leading wildly from one part of a data
structure to another. Their introduction into high-level languages has been a step backward from
which we may never recover.
Keep reading
Out of respect for the author only the opening is shown here. Read the rest on the original site, or in HorizonReader with highlights, notes and AI help.
In July, I described a way to make pinning more ergonomic by integrating it more fully into the language. Last week, I develoepd that idea further with the notion of UnpinCell: a wrapper type that lets a user take an &pin mut UnpinCell<T> a
A variation on my previous design for pinned places has occurred to me that would be more consistent with Rust’s existing feature set. The most outlandish aspect of the previous design was the notion of “pinned fields,” which support pinned
In the previous post, I described the goal of Rust’s Pin type and the history of how it came to exist. When we were initially developing this API in 2018, one of our explicit goals was the limit the number of changes we would make to Rust,
The Pin type (and the concept of pinning in general) is a foundational building block on which the rest of the the Rust async ecosystem stands. Unfortunately, it has also been one of the least accessible and most misunderstood elements of a
This post is meant as an explainer about how substructural type theory can be applied in programming language design. Terms like “substructural type theory” tend to scare and confuse programmers who don’t write Haskell on the weekends, so o