• 0 Posts
  • 48 Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle
  • But how does the Rust compiler do that? What does it actually check? Could I write a compiler in C that does this check on a piece of Rust code?

    C is so simplictic, that if I can write a piece of functionality in C, I must understand its inner workings fully. Not just how to use the feature, but how the feature works under the hood.

    It is often pointless to actually implement the feature in C, since the feature already has a good implementation (see the Rust compiler for the memory safety). But understanding these features, and being able to mentally think about what it takes in C to implement them, is still helpfull for gaining an understanding of the feature.



  • I have this experience with a certain type of pedestrian traffic light “button”.

    I quote button, because nothing physically moves when you press it. I’m not sure if it registers pressure or heat, but you don’t even feel anything move when you press it.

    Usually when you press the button, a red text lights up on the button, telling you to wait. This text gives you feedback that the button registered your press, and the traffic light will schedule a green light for you.

    However, sometimes you didn’t press hard enough, and the text doesn’t light up. Simple solution: press harder.

    But there is a scenario where it doesn’t matter how hard you press, the button won’t light up. You keep staring at it, while slamming the damn thing with the fury of a Hulk wealding Mjolnir. Still, nothing lights up. The reason: the light instantly went green, so it never needed to light up the text telling you to wait. And all that time slamming your fist on the button, could have been spend crossing the intersection. Instead you have been standing there, looking like a drunk person having a fistfight with an inanimate object.




  • I remember a javascript library where the was a function that returned, according to the documentation, “a color”. Did it return an object with 3 fields? Were those fields RGB or some other color scheme? Is it a string encoding a color? What format is that string? None of these questions could be answered without just running the code, and analyzing the object you got back.




  • Large beer containers are “rare” for the same reason large soda containers are rare: carbonization. If you store an opened bottle of beer for a few hours, it will go flat, killing part of the taste with it. Beer is even worse in this regard than soda. You want to finish the whole thing in one sitting for beer. Very few people consume 2 litres of beer in one sitting. … But … Every single self respecting bar has beer from the tap, right? That stuff doesn’t appear magically. It comes in kegs. You can buy those kegs from a wholesaler, or from the internet. These kegs work by inserting CO2 to pressurize it. So you will need CO2 tanks and a system to pressurize the whole thing. Not super hard to get, but not something you find in your supermarket either. But if you consume enough beer, it can absolutely be worth it to buy a tap, CO2 and kegs instead of bottles.



  • Do you mean that programming languages are hard to read/write, or that the languages themselves are poorly designed?

    In the former case, I invite you to read machine code. Not assembly, but straight machine code. Just zeros and ones as far as the editor can see. Any popular language is better than that.

    In the latter case, I invite you to look at the design of an arbitrary natural language. Weird grammer rules, regional differences, loan words that don’t fit in, etc. No programmming language is worse than that. Although I would argue that Javascript has all of those problems too in some degree.



  • In an older version of Stellaris, a cheesy strategy is to abduct or force relocate the entire galaxy onto a single planet.

    Usually having an overcrowded planet, has a several drawbacks.

    Since you can never generate enough food, your population will always be in decline. But this decline is capped per planet, and is quite small. As long as you can keep abducting and force relocating pops from your conquests, you can grow.

    Similarly, you ignore consumer goods for the only cost of a reduction in produced goods from jobs. But you barely produce anything via jobs anyway.

    The low happyness and overcrowding causes stability issues on the planet. But again, the negative stability is capped, so you enable martial law on the planet, and build fortresses, which provide a stability boost per soldier job they create. And only stability matters for revolts.

    You need minerals, but you can get those from mining asteroids.

    Your energy credits come from being a mega church, in which each pop following your religion, generates some credits, along with trade generated per pop.

    Alloys come from turning the planet into an ecumenopolis. Although you get a -50% production modifier, it is the only thing you need to produce yourself.

    But the real trick is giving all the cramped up pops utopian living standards. In this version of Stellaris, any unemployed pop living in utopian living standards, generated science points and trade value. Usually those are barely worth the extra cost of letting the pop live so luxuriously. But even if you don’t provide food and consumer goods, they still provide sciencd and trade.

    As a result, you got a stable planet generating insane amounts of science, energy credits, and alloys. While remaining a small empire, which kept tech costs low.