Better HN
topnewbestaskshowjobs
Log inSign up

codeflo

9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions

Submissions

comment 4y ago · link · parent

I’ll prefix by saying I agree with a lot of the criticisms, and I’ve experienced first hand how hard to explain and error prone hooks are. But for this post, let me defend the concept.

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

It’s often not even that much manual housekeeping. If you follow the second advice, then ESLint will do a fine job of telling you exactly what’s missing or superfluous.

(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

Another point about bootstrapping an ancient version of GHC first and using that to build more modern versions: you need to run the generated x86 code (that also targets an old OS version) to do that, and it’s increasingly not a given that you can do so natively.

comment 4y ago · link · parent

This is almost content-free, and the little that is there misuses/confuses terminology. Not HN worthy material to put it mildly.

comment 4y ago · link · parent

The formulation that the forces “cancel out” at the Lagrange points bothers me, even though it’s not technically wrong.

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

That’s true, a binary tree isn’t a problem, it’s a tool for solving a certain class of problems. Since you can’t build reusable tools in pre-generic Go, (and, to be honest, only a limited set of tools with Go’s new generic system), programmers are forced to reinvent half-baked ad-hoc solutions all over their code base. I once read an article about a C codebase that contained dozens (!) of specialized linked-list implementations. Large Go codebases, from everything I’ve seen, aren’t all that different.

comment 4y ago · link · parent

Multiple dies integrated with an interconnect on a single chip is how you build big processors these days. AMD has been doing the same thing for years, and I’m sure the largest M2 will as well.

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

Linked from Tufte’s article, I found this interesting comment from someone’s experience at Microsoft: [1]

> 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

For a clean build and a reasonably specced machine, all the intermediate artifacts will still be in the cache during linking.

comment 4y ago · link · parent

The virus signatures haven’t been updated since my last recompile though.

comment 4y ago · link · parent

> People that have never used the Oracle RDBMS give it grief because of Larry, the rep of the company, etc

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

“Allowing unproductive distractions” is one of the major reason why I think home office is fundamentally less productive, no matter how much people have come to like it. Pair programming through screen sharing works fine on a technical level, but you can’t turn off children.

comment 4y ago · link · parent

Medium term certainly, but short term, who knows. Prices go up, supply chains become interrupted, factories that process food go out of business. And it’s not like poorer countries in Africa can simply buy their way out of any supply issue the way the West can.

comment 4y ago · link · parent

It seems so easy to fall into a false balance trap. But while Western media is certainly flawed, there’s a fundamental difference between honest mistakes and intentional lies. The truth is very unlikely to be half-way between the two.

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

It is talked about, but maybe not to the extent that it could be. For obvious historic reasons, race and class are highly correlated. I think this causes certain class issues to disguise as race issues and vice versa. To be clear, both kinds of discrimination exist, both are terrible. But people are sometimes bad at separating correlated variables intuitively. And, how do I put it, the social sciences don’t have the reputation to always use the most statistically sound methods.

comment 4y ago · link · parent

> As far as I know, the answer is simply that your eyes aren't rectilinear

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

Does this simply remove the JavaScript or do something more clever? Because I think in the age of SPAs, the proper way to save "content pages" might be to execute the JavaScript once and serialize the resulting DOM back to HTML. I didn't find anything in the FAQ that explains if it does something like that.

comment 4y ago · link · parent

Aperture size has an effect on depth of field (the degree to which points that are out of focus are blurred). I think in practical cameras, aperture size isn't constant as you vary camera size, so that makes the scale relevant. But I'm not 100% sure how photography terminology like "stops" maps to the underlying geometry, so take this with a grain of salt.

comment 4y ago · link · parent

I was looking for someone commenting this. There's no mystery, it's really just geometry. Imagine casting a ray from your eyeball to a pixel on the monitor. Then imagine the same ray at the same angle on the actual scene. If the pixel matches the correct part of the scene, then the image appears natural.

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

Absolutely true. I’d add that Rust is also doing a lot more expensive optimizations in release builds.

comment 4y ago · link · parent

It’s not just a random implementation artifact. Since all slices in Go are mutable, it logically wouldn’t make sense to upcast them while keeping the reference. That would mean the ability to put other objects in the slice. Same for pointers.

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

From the article you linked, those subdictionaries seem to support calling a function g[T1] inside a function f[T1, T2].

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

In whatever way these terms will eventually crystallize, I think the addition of meta-progression to the permadeath+randomization combo is important enough to call the result a new genre. It’s a very fun and addictive combination.

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

> Do Visual Studio/C# coders typically see the many different universes of tooling outside of the limited MS Stack as childish or less evolved?

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

True, but I think enabling more cases where you can use function composition instead of pattern matching and explicit recursion would be a win.

comment 4y ago · link · parent

The GHC approach you describe is also what people do with Results in Rust, and (analogously) with Java's typed exceptions. The idea is that in a multi-layered program, every layer exposes errors that are semantically appropriate for that layer. So (to pick a silly little example) a database call would expose a DatabaseError, not a raw network error if the connection is interrupted. And so on until you get to the level of application-level errors. I think that can work very well.

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

I've written small stuff in Haskell a decade ago. I have a soft spot for the language -- it has clearly influenced many notable languages that came after it. But I also admire the patience of anyone who actually manages to use it in practice, there are so many little papercuts that don't get resolved, basically for a decade or more. If I'm cynical, I'd say that's because little practical stuff is often not worth publishing papers about.

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

> I've also heard of servers getting ddosed if they are known to pirate paid addons.

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

I also hate it when technical terms are needlessly overloaded, and I can only assume it's often because our field is fractured enough that even widely known terminology might not be known in every little niche. But one has to wonder... don't people use Google when they invent new terms?

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

No, I would agree that something with a smaller runtime might be considered closer to the metal, I was talking about level of abstraction, which I think is different. One example is that a typical C code that depends on a libc is farther from the machine than C code that runs without a libc. Both might use very similar styles.

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.

1
282930
51