fwlr
Joined 3 years ago
Joined 3 years ago
I couldn’t tell you if AI code assistants would write this, or catch it - ironically enough, “the perils of programming in plain text” is one of my stated reasons for eschewing AI assistance.
Given that the succinctness just bit me, I’m inclined to sacrifice it and go with
// over the range 0..23, +1 gives the same result%2 as -1, and also handles edge case of 0
const lastHour = new Date().getUTCHours() + 1
…
env.QUEUES[lastHour % 2]
Fundamentally I guess I was just objecting to doing arithmetic in the time domain to achieve negating a boolean.Demonstrates fanatical devotion to capital’s golden idol - “yes, all of the code; yes, unlimited budget”. Doesn’t actually cost the company anything - only one engineer off task, any nuggets of value can be harvested as it progresses but any costs or big changes can be deferred until completion of the impossibly large open-ended mandate (ie never), one guy won’t have the personal bandwidth to spend so much that the “unlimited” part actually matters, and in case of emergency it only costs six months severance to make it all go away. It even rescues a fellow national from the ignominy of being employed so far below his previous station, there’s so much to like about it. Hmm? The code? What about it?
Ugly code though.
// env
QUEUES = [EVEN_QUEUE, ODD_QUEUE]
// producers
env.QUEUES[hour % 2].send …
// consumer
env.QUEUES[1 + hour % 2]But we don’t get to the future by making one big choice of which future we desire, whereupon we are transported there instantly. We get there slowly, at a rate of one day per calendar day, by making innumerable microscopic daily choices. These choices will be endless, it will often be unclear which option avoids the bad future, they will accost you when you are tired and hungry… and several corporations have collectively trillions of dollars riding on you ending up with the bad future and the legal right to tilt the playing field.
The reason we must not do UBI is that UBI turns consuming into a product, and humans will very rapidly be outcompeted and obsoleted by more efficient consumers. It would wrap the invisible hand of the market tight around our species’ throats.
Zig is also a C compiler
Here’s an example of Zig building some C code:
hello.c
> #include <stdio.h>
>
> int main(int argc, char **argv) {
> printf("Hello world\n");
> return 0;
> }
$ zig build-exe hello.c -lc
$ ./hello
> Hello world