Better HN
topnewbestaskshowjobs
Log inSign up

codeflo

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

Submissions

comment 5y ago · link · parent

It’s not just crates.io. I have a minimal, no Libc, no runtime dependencies Windows project for fun that compiles to a tiny executable of only a few kilobytes. If you’re going down this minimalist/better C route, you increasingly have to avoid large parts of the Core library as well, which is becoming more bloated by the minute. The culture seems to move in the direction of “avoid unsafe at all costs” (even where that makes the API so complicated that it hurts correctness in practice) and “avoid dynamic dispatch at all costs” (even where that hurts performance).

comment 5y ago · link · parent

You’re correct. The more aggressive version of this is called “move pruning”, effectively cutting off entire branches of the search tree. Techniques like this are essential for the strength of modern chess engines, but like every heuristic, they can be wrong. Sometimes, the engine makes a mistake because it literally didn’t consider a certain response.

comment 5y ago · link · parent

That’s mostly my point though, if “doubling down” works best with impressionable, unreasonable (in this case, young) people, then the strategy limits you to that audience.

comment 5y ago · link · parent

That’s a pessimistic way to put it, but you have a point.

This depends on the target audience though. Some people seem unable to be convinced by hard evidence and reason. If you’re able to pick your audience — which is the case for content creators and politicians — you will always be able to address those people.

In most professional settings, you’re more dependent on the goodwill of someone specific, and I think there the strategy is less effective.

comment 5y ago · link · parent

I can totally see how this kind of convenience might hinder learning. For me, the fact that “&a” does so much magic type conversion stuff had a similar effect. One thing I sometimes find helpful is to run an IDE (like VS Code with the Rust Analyzer plugin) and hover over every single variable to see its type.

Out of curiosity, since I expect to give a short Rust introduction in the near future, what was your language background when learning Rust? How familiar were you with C-style pointers and/or C++-style references?

comment 5y ago · link · parent

Match ergonomics was one of the greatest improvements to the language, I’d personally put it almost on par with NLL.

For anyone who’s interested:

In Rust, you tend to do a lot of pattern matching and destructuring. But you also often only have a reference to your data, because copies can be expensive.

Combining pattern matching and references was always possible, but confusing: you had to place lots of “ref” annotations in various places, which I never got right on the first try. But now, you can magically destructure e.g. a reference to a tuple into a tuple of references. You don’t have to think about it, it simply works. Combined with Rust’s algebraic types, this allows you to write very elegant, almost fp-like code that’s also zero copy.

comment 5y ago · link · parent

It's great that many HNers like Syncthing, but personally, I seriously tried it maybe two years ago and didn't have a great experience.

I wanted to sync my personal files between three computers, two desktops and a notebook, which don't always see each other. At first, this worked great. Obviously, there were conflicts when I accidentally edited something in two places without syncing up. What I didn't figure out was how to permanently resolve those. I ran into endless cycles were I had a conflict between two systems, resolved that, but the third one hadn't seen the conflict resolution, which produced another conflict, which I resolved, which the first system hadn't seen yet, ad infinitum. At least, that's what it looked like. Among other errors, files long since deleted on all systems would still show up as conflicts.

To be fair, I didn't actually lose any data, and it's very possible I did something wrong that would be obvious to other people. But to me, it wasn't at all clear what and why, which scared me enough to move away from this setup. I don't want to take a lot of chances with my data.

comment 5y ago · link · parent

5/5 on hard node, but it’s tough sometimes, I don’t actually know much about biology. But if you’ve played around with GPT before, you get better at spotting the subtle logical errors it tends to make. I wonder whether the ability to identify machine generated texts will become a useful skill at some point.

comment 5y ago · link · parent

> You don't want your games to look realistic? Go play pacman or outrun.

That's a silly dichotomy. We don't even want films to look completely realistic, that's why CGI exists in the first place. Imagine that you ran this over something like an Avengers movie, or even better, Blade Runner 2049. The AI would remove all the stylized/unrealistic details, and someone here would claim that this is clearly an improvement, and any criticism must come from luddites!

comment 5y ago · link · parent

No need to be sorry, I'm not the designer in this story -- I'm the grumpy sofware engineer, and nowadays sometimes the manager. I'm also a desktop Linux user who is regularly annoyed by the sad and confusing state of opensource UX. What makes me so pessimistic is that I know the social dynamics that typically cause this, and have seen them play out in lots and lots of mailing list discussions.

Of course that's not a logical inevitability, things can change with more understanding. Your link actually makes me very happy, I hadn't seen this. Let's hope that this works out, and becomes a model that more OSS project can follow.

comment 5y ago · link · parent

So Google’s inability to update Android causes them to compromise on its security?

comment 5y ago · link · parent

It’s even worse, I think. Good UX design looks deceptively easy, but is actually incredibly hard. So hard that a lot of programmers don’t even recognize how terrible they are at it, or how high the skill ceiling actually is. They think UI design is pretty colors and rounded buttons.

In a functioning software company, the managers recognize this skill difference and simply order the developers to implement what the designers suggest. They grumpily do. (It’s obviously not always so stereotypical. I’m exaggerating to make a point.)

In a typical OSS project, no one can give orders. The programmers ignore any good design suggestions because they don’t recognize those, and implement their own crappy ideas instead. Sometimes while arrogantly dunking on the designer who tried to make a contribution. Consequently, UX quality is abysmal, and anyone who could fix that is driven away. I don’t see a solution to this.

comment 5y ago · link · parent

But why, except to claim “web-scale”? Especially for publishing events, isn’t something like MQTT a lot saner?

comment 5y ago · link · parent

I hope we agree that alternative mnemonics don't change anything essential about the code, so the equation "kind of" still holds. You have a point that it's hard to formulate this precisely.

comment 5y ago · link · parent

Is macro assembly really assembly though? I clicked no because I claim that there’s a continuum of expressiveness between a macro assembler and a C compiler, which makes it hard to draw a line. This is debatable of course, and I was hoping the article would go into some of this. Instead, the analysis seems to stop at “if it’s called assembly, it is assembly”, unfortunately.

Edit: I suggest that as a necessary condition for something to be assembly,

disassemble(assemble(x)) = x,

modulo comments and label names.

comment 5y ago · link · parent

It's essentially an admission that the "mitigations" they claim to have implemented (second paragraph) aren't that effective, and they want to outsource the review effort to the community. Which is fine in my opinion, but I agree that the current tools might not be fine granular enough. There should also be clearer messaging about what happens when there's an honest review mistake and a crypto miner slips through.

comment 5y ago · link · parent

128 MB in a 486 is insane. 16 MB was a lot in that era. I remember upgrading my Pentium II (!!!) from 64 MB to 128 MB, in order to not suffer death by loading screen in Diablo II.

comment 5y ago · link · parent

I worked on a mixed C++ and C# codebase where we switched from in-process calls to IPC for that very reason, taking the efficiency hit. Having the .NET runtime running in the same address space confused any sanitizer or leak detector. You rely on those tools to manage a large C++ codebase in practice.

Also, because the .NET GC churns through a lot of memory, statistically almost every problem on the C++ turned up on the C# side first, sometimes with very confusing effects. For example, .NET has a compacting GC, so an object can get corrupted and then randomly moved somewhere else. We didn't have that kind of problem often, but when we did, it was pure hell to debug.

comment 5y ago · link · parent

What you call the "pessimistic view" might be very enthusiastic about projects that are orders of magnitude more likely to work. So in my opinion, the relevant axis is not optimistic vs. pessimistic, but informed vs. uninformed.

Can an outsider with no knowledge of the field make a chance discovery? It's theoretically possible, and we might want to support undirected experimentation for the one in a billion chance that something might work. But we should take those probabilities into account when allocating our collective resources.

comment 5y ago · link · parent

“If there are sources” — the answer is different depending on whether you speak German or not. The practices of the so-called “Abmahnindustrie” (legal warning industry?) are well publicized in German media and widely known in the German tech sector. It might be hard to find an authoritative source in English.

As far as I understand, they don’t get that much more damages from larger cases, so they target masses of small fish instead. Individual ebay sellers, small private clubs (which are ingrained in the German culture) and the like.

comment 5y ago · link · parent

This may be splitting hairs a bit, because we all agree that this is a good example where using Rust in this straightforward manner leads to suboptimal performance. But I agree with the grand parent that this is mainly an issue with safety, not with the type system itself.

To show why, consider two alternative languages.

“Weak Rust”: an equally safe Rust with a weaker type system. It might not distinguish & and &mut, but it would still need those checks, because you might use those shared references to break a data structure invariant. It would have to detect such unsafe usage at runtime and raise the equivalent of Java’s ConcurrentModificationException.

“Unsafe Rust”: a less safe Rust with an equally strong type system. It wouldn’t need to do those checks. In fact, that’s basically C++.

comment 5y ago · link · parent

I think this advocates a certain style of concurrency rather than a particular language feature.

As hinted at in the article, nothing prevents me from spawning a global_nursery at the top of my entry point and making that visible everywhere. I can still use this global_nursery (or any other higher-level one) to break resource cleanup.

I do find the argument compelling. But Python is simply too powerful for this abstraction to work perfectly, you’d need further restrictions. Maybe something like linear types (or Rust’s borrow checker) to make sure local state doesn’t escape into global nurseries?

comment 5y ago · link · parent

Don’t downvote, it’s a really good question. Naively, I’d also have expected Rust to be faster, given the same algorithm. My guess is that without a GC, the Rust solution can’t delay deallocating all those temporary strings (both variants seem to allocate a string for each word, though I’m not sure if Go doesn’t simply share string slices). GCs free memory in batches, which is often more efficient, and sometimes don’t have to do it all on process exit. The Rust code meticulously deallocates each string individually.

comment 5y ago · link · parent

I think they meant function pointers in general (callbacks and the like, see qsort). Also, a lot of C codebases end up implementing manual vtables of some sort where polymorphism is required.

comment 5y ago · link · parent

The problem is that compilers are allowed to make some general assumption about how they're allowed to reorder code, always based on the assumption that no other process is modifying the memory. For example, the optimizer may remove redundant reads. That's a problem if the read isn't really redundant -- if the pointer isn't targeting process-owned memory, but a memory mapped file that's modified by someone else. Programs might crash in very "interesting" ways depending on optimization flags.

C has this issue as well, but Rust's compiler/borrow checker is particularly strong at this kind of analysis, so it's potentially bitten even harder.

comment 5y ago · link · parent

I had a situation like this recently at a smaller company. Candidate claims years of expertise in X and Y. We have great X people, but would like to hire someone with deep Y knowledge. So we (more out of routine than any particular strategy) probe X in the interview. Turns out the candidate is beginner level at best, and also a bit arrogant about it. Would you in that situation believe the Y claims, that you can’t evaluate as deeply to begin with?

comment 5y ago · link · parent

I see no content except a book blurb. Is this more than advertisement/spam?

comment 5y ago · link · parent

That’s one of my favorites as well. The fact that C++ will so happily auto-convert almost anything into an integer makes it even more likely to hit this accidentally.
1
373839
51