9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions
comment 4y ago · link · parent
Ha ha ha, no. That’s a wild misunderstanding of evolutionary theory, that humans are somehow “more evolved” than other current species. Modern apes are our siblings, not our ancestors. And nothing fundamental “separates” us from other animals: we’re yet another species, granted with some unique features that we ourselves consider very important.
comment 4y ago · link · parent
For example, I like how the catch block is just a single function call to handleErrorSomehow — which would be totally fine for an example, if it weren’t for the fact that the author makes a special note of how convenient it is that the Promise variant reduces to just .catch(handleErrorSomehow). Suuuper-realistic.
I should probably admit that I also didn’t completely see the point of async/await — this was years ago in C# — until I first had a chance to use it inside a complex loop of some kind. I think it’s a good exercise to try manually desugaring such an example. It really makes you appreciate what the compiler’s doing for you in these cases.
comment 4y ago · link · parent
This applies in much lower stakes environments as well: the workplace, relationships. It's surprising how reliably someone's attitude can flip from "if ever X, I'll quit" to "X isn't that much worse than X-1, this isn't worth making a fuss about" if the change happens slowly enough.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
Bear with me here, I know infinitesimal math isn’t a fully coherent thing. But there’s a reason why Newton used it, it sometimes works surprisingly well to make intuitive analogies. Maybe there’s a way to make it work here.
For example: The function ln(x) grows strictly slower than x^a for any positive real a, but faster than x^0. Hence, it’s x^ε, where 0 < ε < a for any positive real a.
comment 4y ago · link · parent
My problem with the word “unsafe” is that many people seem to think unsafe code blocks necessarily have security issues. Hence the bullying of library authors even in cases where the authors did their homework.
Anything about the mechanics of the implementation is a second-order detail compared to that, as far as I’m concerned.
comment 4y ago · link · parent
So I'm confused. Does anyone know, or have a better source, whether there's actual cause for concern?
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
If you happen to think, as I do, that we need safe(r) languages to have any hope of creating secure systems, then problems like these are a striking reminder that memory safety alone isn’t sufficient to achieve security.
comment 4y ago · link · parent
Here’s the thing: You can argue about being secure by default and encouraging better CI practices. I’d fully agree it isn’t great that one has to know a somewhat obscure flag to get a secure CI build in those environments.
But claiming in what I perceive to be in parts a somewhat grandiose tone to have reinvented the wheel, when you’re just describing a standard approach, can make you sound uninformed.
comment 4y ago · link · parent
comment 4y ago · link · parent
You might argue that this box is simply hard-wired to show red, but then I explain: No, your impression is wrong. I’ve built this box, and I’ve taken every possible measure to make it show green.
How credible am I?
And would you be more inclined to believe me more if I told you about my intrinsic love for the color green, and how I wired up the green light first, and how I have an entire committee of experts that has to sign off every design change to this box to ensure sufficient greenness? While it still shows, and only ever will, show the red light?
comment 4y ago · link · parent
Personally, I’ve had cases where three or four places had to be kept in sync, and the list was changing frequently enough that something like this became useful.
Even then, it’s still a judgement call whether code generation or (if available) macros are worth the complexity. The decision might also heavily depend on the experience of the team.
comment 4y ago · link · parent
This describes an interesting approach that I hadn’t seen. I personally wouldn’t have considered putting the result in the same file because I usually like to gitignore any and all generated code, mostly to reduce phantom merge conflicts. However, some colleagues have the opinion that those conflicts are trivially resolved by rebuilding and thus don’t matter, and having diffs of the generated code show up in pull requests adds value.
What do others think, check in generated code or put it in gitignore?
comment 4y ago · link · parent
Stuff like that has to be common. Did the “growth hacking” cynics who design these features not realize the harm they cause, or is the generated “engagement” still worth it in aggregate despite a few lost users?
comment 4y ago · link · parent
One, you don’t rely on a semantic guarantee if you use useMemo for derived state. Avoiding rerendering counts as an optimization as far as the React docs are concerned (your program works if there’s an extra render), and this is in fact exactly what it was intended for. The docs you linked seem to agree: Regardless of whether an offscreen component keeps or doesn’t keep its useMemo, the code is correct and there’s at most one extra render.
Second, while I agree with the verbosity complaint, I personally make a point to use useMemo as coarsely as possible. It’s often completely fine to compute all derived state in a single big lambda that returns one big (immediately destructured) object. It’s only when you have multiple pieces of derived state that update individually and are also all expensive to compute that you actually need fine-grained useMemo calls. And in this case, you can always think about extracting sone of that logic into a helper function/hook.
It’s not perfect, but I think it’s possible to avoid a lot of the pain most of the time.