9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions
comment 4y ago · link · parent
The idea, in a very rough nutshell, is to allow separating behavior and presentation.
Hooks are the reusable unit of behavior. You compose hooks into more complex hooks that might implement loading and saving data from/to the server, for example.
Then you can use this hook with different components, or use the same component in a different context with a different data source. This can be very powerful if used well.
But as I said at the beginning, hooks are unfortunately also very difficult to get right.
comment 4y ago · link · parent
(I argue that ESLint is almost required when working with React. You can turn off its weirder other rules if they become an annoyance, but the hook rules are golden.)
No, I think the problem is the combination of closures, mutability and identity. Very few other things in programming punish you that harshly (and subtly) if you don’t have a crystal clear understanding of all three concepts.
comment 4y ago · link · parent
At each of the five points, there’s a net gravitational force towards the sun (to be more precise: towards the common barycenter). This is easiest to see at L2 and L3 where the gravitational forces pull in the same direction.
There are now two ways to look at this combined gravitational force:
1. In an inertial reference frame (the one we imagine when we say the Earth revolves around the Sun), this combined gravitational force acts as a centripetal force. At the Lagrange points, it has precisely the correct value to keep the object in an orbit with period 1 year.
2. In the reference frame where Sun and Earth don’t move (that is, the reference frame that rotates at 1/year around the barycenter), every point experiences an apparent centrifugal force. At the Lagrange point, this centrifugal force cancels with the gravitational forces to keep the object stationary in this reference frame.
The math is completely the same (x=y vs. x-y=0). I personally just find the first view to be more intuitive.
comment 4y ago · link · parent
comment 4y ago · link · parent
What I find interesting is that there’s no desktop Mac with an M1 Pro, leaving a gap between the entry-level M1 in the Mac mini, and the Mac Studio with its M1 Max.
For those who might not remember the full lineup: the M1 Pro and M1 Max have the same CPU part, the main difference is the number of GPU cores. For many CPU-bound applications, the Pro is all you need.
I wonder if this is an intentional strategy to sell the more expensive product or if it’s supply related.
comment 4y ago · link · parent
> Attempting to have slides serve both as projected visuals and as stand-alone handouts makes for bad visuals and bad documentation. Yet, this is a typical, acceptable approach. PowerPoint (or Keynote) is a tool for displaying visual information, information that helps you tell your story, make your case, or prove your point. PowerPoint is a terrible tool for making written documents, that's what word processors are for.
I think that’s on point for many companies. A lot of the terrible slides you see in meetings are actually intended as documentation after the fact, and few people recognize (or care) that this makes for a terrible presentation.
Ironically, I think Powerpoint isn’t such a bad tool for creating handouts. If the intended reader reads the document on their screen instead of printing it, a nice PDF with screen-shaped pages might actually be close to optimal.
You just have to be 100% clear whether you’re creating a document or a presentation.
[1] http://mamamusings.net/archives/2005/11/19/the_culture_of_th...
comment 4y ago · link · parent
It’s also not developer friendly, like at all. Starting with licensing, that insane installer, arcane configuration, documentation, error messages, standards conformity, column name limits. Our team hated every second of using it.
comment 4y ago · link · parent
comment 4y ago · link · parent
Compare: The 2016 election mispredictions were one of the most discussed topics for months in the aftermath. The Bush administration’s WMD claims are still regularly discussed, at least outside of Fox News. Journalists have in general become more skeptical of US government claims as a result ever since. That’s widely considered a good thing.
On the other hand: Russian media, as should be obvious for anyone with better memory than a proverbial goldfish, doesn’t even care how today’s message contradicts yesterday’s. The sanctions are ineffective and a grave act of war and must be stopped immediately and actually don’t work. Ukraine will never be attacked, and is actually Russian, and commits an anti-Russian genocide, and isn’t a nation, and will no longer be a nation if it doesn’t surrender immediately, and isn’t actually being attacked. It’s so inconsistent with itself that you don’t even need a second source to spot the lies.
I might feel nice and wise and balanced, but I don’t think these are circumstances where believing “both sides” is intellectually defensible.
comment 4y ago · link · parent
comment 4y ago · link · parent
That's true, but not the problem. Think about this logically. The goal is to show the exact same color at the same angle. If you achieve that (possible with VR, also possible with a normal photo but for a tiny angle only), it doesn't matter how the eye or processing in the brain warps the image afterwards.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
But that's really a tiny field of view. Perhaps the easiest way to see this is that it's the same geometry as having a monitor-sized window in a wall at the same distance, and looking outside. That would be really tiny window, and you wouldn't expect to see much of the outside without getting a lot closer.
As a result, most pictures are taken at a wider field of view than what would be natural for typical viewing distances, to show more of the scene. Which explains the distortions that make everything at a distance appear tiny.
You fundamentally can't "solve" this without dramatically increasing the FOV that you're viewing things with -- VR being the obvious idea.
comment 4y ago · link · parent
That’s a basic fact of type safety that people often get wrong. For example, the JVM famously allows upcasting arrays, with very surprising results.
comment 4y ago · link · parent
There’s a concept called polymorphic recursion, supported by languages like Haskell, which goes beyond that and allows using arbitrary derived types in a function, in particular, in recursive calks.
My interpretation of the section in “non-monomorphisable functions” in the original article is that Go’s compilation strategy doesn’t handle that currently.
comment 4y ago · link · parent
I’m also going to say that unlocking cards qualifies as progression. Unlocking pure cosmetics is not progression, and unlocking starting options (like available character classes) that are intended to be mostly balanced is a grey area.
One thing classical roguelikes had was local highscore lists (they were intended to be played on a shared mainframe), which would be meaningless with meta-progression. I find it interesting that Spelunky, which follows the old formula a lot more closely, also has a mode with daily leaderboards. That’s not really something for me, but I think many people really enjoy that kind of fair competition.
comment 4y ago · link · parent
Don’t extrapolate too much from N=1. I used to work in a shop that mainly uses Microsoft technology. From those dozens of engineers, I don’t think I’ve ever heard that opinion. I would say the opposite, my impression was that most of them were quite happy with the increasing Unix-ification of Microsoft’s stack.
comment 4y ago · link · parent
In the same spirit, I find the article you linked to a bit silly, at least the examples they picked. Following the logic above, there shouldn't even be a "HeadError" exposed anywhere up the call chain. Inventing a complicated mechanism to propagate the error upwards is the opposite of what you want to do; you want elegant ways to handle the problem locally. Having a special singleton HeadError isn't wrong, but I think "Maybe a" would also be a perfectly fine return value for head (as I mentioned in a sibling post, that's what Rust does): head can only "fail" if the list is empty, so there is no actual information in the "error" value.
comment 4y ago · link · parent
Error handling was, for me, a big one. For a functional language, Haskell seems very obsessed with exceptions. Even supposedly pure stuff, like "head" (first element of a list) throws an exception if the list is empty. You'd think Haskell would be the first language to have it return a Maybe value, but no. (Rust, BTW, gets functions like this right; they all return an Option.)
This reliance on exceptions clashes hard with the functional paradigm. Exceptions are "magic": They are special additional values that any type can have (so an Int can either be an actual integer or an exception value), but you can't test for them or handle them in any way pure code, you need IO for that. Which the language makes intentionally hard to use, that's Haskell's entire thing.
comment 4y ago · link · parent
That's certainly an interesting way to police copyright violations. It's funny how the communities you describe might have foreshadowed NFTs. What I wonder is, do people no longer view these item as... just data?
I don't feel remotely old enough to use that phrase, but "back in my days", we were proud that data is a new kind of thing that can't be locked up or limited the way physical items can. I wrote little scripts to extract sprites from game files all the time. A "right-clicker", as you might say, only that little actual clicking was involved.
I still can't wrap my head around the fact that there are now "underground" communities who will happily do the exact opposite.
comment 4y ago · link · parent
Either way, I found this paper that describes a certain obfuscation technique as virtualization [1]. I can only assume that devirtualization is meant as the corresponding deobfuscation technique. So maybe it is the correct, if unfortunate, term. Quote:
> Virtualization-obfuscation replaces native code in a binary with semantically equivalent and self-defined bytecode, which, upon ex- ecution, is interpreted by a custom virtual machine.
[1] https://cis.temple.edu/~qzeng/papers/deobfuscation-icics2017...
comment 4y ago · link · parent
I'm also not saying JIT vs. AOT is an irrelevant distinction in practice -- like everyone else, I like my programs to start fast. But in the end, you have machine code in RAM either way; the level of abstraction is, all else being equal, the same.
The precise details of how that machine code gets there change nothing about how the program is written. The emphasis people put on those details aren't always warranted. I don't think they matter at all for typical backend code, which is one of Go's main niches.
Edit: The earlier version of this response was maybe unnecessarily pointed, I expanded and toned it down a bit.