2,676 karma · joined Nov 28, 2019 (7y ago) · 1,131 submissions
comment 2y ago · link · parent
My store has a few different brands of coconut milk. Some of the unit prices are per pound, while others are per quart. I make the approximation that coconut milk has the same density as water, which is two pounds per quart. The unit prices are all odd three digits numbers. It's a pain.
You could have one person who works in an office somewhere who's responsible for itemizing inventory for the whole grocery chain. They could solve this problem (maybe automatically!) with a spreadsheet. They could also solve the problem of tomatillos not being registered in the self-checkout catalog. But what is that person's salary paying for in the company's eyes?
To be fair, maybe the real explanation is "lots of stuff, shit happens." And it's only a factor of two (for watery goods, anyway).
comment 2y ago · link · parent
Also "a computation is not and cannot be constant" depends on what is meant precisely by "computation" and "constant." Is "23 * 48" a constant, or is it a computation? What about "2208/2"? What about "1.104e3"?
You can define "constant" as "something that is not computed but that exists in the program as an immediate value." In that case you're right but only by definition. And the compiler must still "interpret" the immediate value. It's a slightly fuzzy distinction in my eyes.
comment 2y ago · link · parent
That said, I don't envy their job. But it seems to be a systemic attractor of asshole.
comment 2y ago · link · parent
He was describing a case to me that involved the government suing his client over something. It turns out that the prosecutor's case was based on a misunderstanding of the relevant laws. Millions of dollars and potential jail time were on the line.
I asked my uncle "do these prosecutors, their office, or anybody face potential retribution for nearly ruining this guy's life and likely ruining his business?" My uncle replied "no, there is nothing that can be done to them." I asked "so if some asshole in a prosecutor's office doesn't like you or is a dumbass, he can just ruin your life and that's it?" "Yes," he said.
I can understand why this is. If law enforcement, generally, were subject to the same liability as regular citizens, that is all anybody would seek to do when the law looks at them. The result would be "playing it safe," and prosecutors would only seek the easy cases, leaving the bulk of crime to happen without repercussions. I don't know what can be done, and there is likely no general solution, but thinking about this makes me realize that "freedom" is not exactly a thing. At least in this case the guy could hire a good lawyer and avoid the worst.
comment 2y ago · link · parent
comment 2y ago · link · parent
It's too late now. void pointers are used as a pun to mean "type wildcard." If void were a real thing that could have a size and address, that wouldn't work anymore.
comment 2y ago · link · parent
How about we do a similar thing for ASTs? Like a peephole optimizer looking for runs of instructions that could be substituted for simpler alternatives, a tree diff could identify diff patterns that "might be trivial." You have a whole catalog of these patterns, and assign to each a weight. Then the displayed diff is the optimal set of choices "consider different or not?"
You would need some additional ingredient, though; some boundary condition. Otherwise "everything is the same" would always minimize badness.
comment 2y ago · link · parent
It's harder to imagine how you can reclaim the energy of the computation. Overwriting a bit requires a little energy even in principle, and then you can't get it back. Maybe this is what the commenter I was replying to meant by "all energy generated ends up as heat." Even still, I'm tempted to make the distinction between the energy that is needed to perform the computation and the energy that is lost e.g. to Joule heating.
comment 2y ago · link · parent
If you push a stone up a hill, then some of the calories you burned went into the gravitational potential energy of the stone, and some up it was lost as heat.
If you compute the SHA hash of some string, then some of of the energy from the power supply went into switching the voltages in transistors, and some of it was lost as heat.
comment 2y ago · link · parent
comment 2y ago · link · parent
I suspect that the perspective of "It sucks but it works for us; I'm not idealistic anymore" is really a rationalization of despair, but that's just me.
comment 2y ago · link · parent
These people who don't pick up for an unusual area code: don't they know that spammers are more likely to call from a "usual" area code? Am I mistaken?