I wrote up some of the compiler stuff I've been noodling on for the last month or so:
I also fleshed out my consulting page as I look for work for the winter.
zig 0.11
I updated all my zig projects with fairly minimal effort. zig fmt
handled everything except the build system, though I did spend a little time removing redundant @as
from it's edits.
The most notable change is the first alpha release of the package manager. It's definitely early days. The biggest restriction at the moment is that it doesn't handle transitive non-zig dependencies very well, leading to boilerplate like this and this. But it's still a welcome change from git submodules.
Foreign target testing looks wild. I'm looking forward to being able to zig test -fwasmtime
my compiler.
@inComptime will make it much easier to write code that works at comptime and runtime, especially when allocating memory.
wasm_allocator is timely - I use it for the runtime of the toy language above.
Attack of the killer features
Zig has two features which appear to be incompatible:
- Result location semantics - in
x = f()
the return value off
is written directly to the location ofx
, rather than written to somewhere inf
's stack frame and then moved. This is really important for self-referential structures like async callstacks. - Parameter reference optimization - in
f(x)
the compiler is free to pass a pointer to x rather than copy the value intof
's stack frame.
The problem is that when you combine these in x = f(x)
they produce surprising aliasing bugs. The body of f
might start writing to it's return value before it finishes reading from it's argument, but in this case the return value and the argument both have the same location.
I don't think this is a problem in a language like rust or val where the compiler can always determine if two variables might be aliased - it can simply disable PRO if it would produce aliasing.
Zed: Leveraging Data Types to Process Eclectic Data
I played with zed last year but I just noticed they had a paper in CIDR this year. It's a (somewhat) better explanation of what they are trying to do than their website is.
Attention Span
Nothing particularly surprising. Lots of filler.
In their in-the-workplace experiments, getting workers to batch their handling of email didn't show any improvements - they were still anxious knowing that the email (and it's attendant expectations) were piling up. Stress levels only went down when they modified the email system itself, so that everyone knew that noone could see or respond to emails before a certain time.
Pleased to see that the last chapter acknowledges that collective action is required - most individual workers just can't choose to not be constantly available.
I'm so sorry for psychology's loss, whatever it is
I dipped my toe into academic cognitive science for a year or two and found it incredibly frustrating that so much work didn't seem to have any point. This article captures that so well:
It says nothing about the scientific impact - the theories that have to be rolled back, the models that have to be retired, the subfields that are at square one again. And looking over Stapel's retracted work, it's because there are no theories, models, or subfields that changed much at all. The 10,000+ citations of his work now point nowhere, and it makes no difference.
Apparently is possible to reach the stratosphere of scientific achievement, to publish over and over again in "high impact" journals, to rack up tens of thousands of citations, and for none of it to matter. Every marker of success, the things that are supposed to tell you that you're on the right track, that you're making a real contribution to science - they might mean nothing at all.
Privatizing Sovereignty, Socializing Property
An interesting observation - how corporations actually work doesn't actually align with how they're described in most economic theory:
Although Hansmann and Kraakman [...] persisted in speaking of stockholders as the "owners" of the corporate firm, their arguments showed that there is no meaningful sense in which this is true. Stockholders cannot use the assets, exclude others from them, lend them out, borrow on them, sell them, and they have no legal claim to the proceeds from the sale of assets or to company profits. Instead, all of these rights of ownership belong to the corporate entity, which management exercises on its behalf, because it is the corporate entity that is their true owner.
Moreover, stockholders do not even have a right to the profits that remain after all contractual obligations have been met - the so-called 'residual.' The corporate entity is the residual claimant, and this residual profit is then allocated at the discretion of management.
Furthermore, if stockholders are neither owners nor authorizers, why are they given [...] the sole right of electing the board members? If the board's authority comes from the state, and the state is constitutionally mandated to guarantee to its citizens a republican form of government [...], could it be argued that workers, who are the subjects of the board's government, have a constitutional right to a republican form of corporate government, in which they elect the board?
And if the board's authority is of public provenance, then is private profit a sufficient rationale to justify a corporation's creation? Were earlier generations of legislators not correct to expect from corporations some public benefit beyond the ordinary, especially given the moral hazard that attends any institution in which those who control it do not bear liability for the consequences of this control?