Live data from Hacker News

A Rust shaped hole

mnvr.in

141–150 of 319 posts

Re: A Rust shaped hole

#141
post #115

Earlier quoted context omitted.

Yeah, and C can get unreadable fast. Obfuscated C contest is a great example: https://www.ioccc.org But that doesn't mean it's a good idea to use such style for PRs, lol.

Rust is unreadable by default

Syntax could be less terse and abbreviated, I agree. But it's not unreadable. On the other hand some complain that Rust sometimes is too verbose, so I guess it's some balance.

Re: A Rust shaped hole

#142
post #128

Earlier quoted context omitted.

> In practice, I never had a problem with "restrict". That's exactly because it's too dangerous and the developers quickly learn to avoid it instead of using it where appropriate! Same with multithreading. C leaves a lot of optimization on the table by making the available tools too dangerous and forcing people to avoid them altogether. That's how you get stuff like memory-safe Rust PNG decoders being 1.5x faster tha…

Na, sorry. The "70%" is just nonsense. And cherry picking individual benchmarks too.

> The "70%" is just nonsense.

Care to elaborate why?

> And cherry picking individual benchmarks too.

Do you have any general, comprehensive benchmarks or statistics that would indicate the opposite? I would include one if I had one at hand, because that would be a stronger argument! But I'm not aware of such benchmarks. I have to cherry pick individual projects. I don't want to.

I still claim that, as a general trend, Rust replacements are faster while also being less bug-prone and taking much less time to write. Another such example is ripgrep.

Re: A Rust shaped hole

#143
post #115

Earlier quoted context omitted.

Yeah, and C can get unreadable fast. Obfuscated C contest is a great example: https://www.ioccc.org But that doesn't mean it's a good idea to use such style for PRs, lol.

That's a really weird example to give. You can write unreadable code in any language if you're determined enough

Well, C has such contest, not every language on the other hand.

Re: A Rust shaped hole

#144

> If someone posts a patch or submits a PR to a codebase written in C, it is easier to review than any other mainstream language. There is no spooky at a distance. [..] Changes are local. Lol, wut? What about about race conditions, null pointers indirectly propagated into functions that don't expect null, aliased pointers indirectly propagated into `restrict` functions, and the other non-local UB causes? Sadly, C's e…

If anything I'd like an even lower-level Rust.

There's so many good high-level languages to choose from, but when you need to go low-level, there's essentially only C, C++, Rust. Maybe Zig once it reaches 1.0.

What we need isn't Rust without the borrow checker. It's C with a borrow checker, and without all the usual footguns.

Re: A Rust shaped hole

#145
post #9

I don't think you need an elaborate process of elimination when one of your axioms is "must manage memory manually".

He's saying exactly the opposite

> Rust... But it requires me to manage memory and lifetimes, which I think is something the compiler should do for me.

Re: A Rust shaped hole

#146

> If someone posts a patch or submits a PR to a codebase written in C, it is easier to review than any other mainstream language. There is no spooky at a distance. [..] Changes are local. Lol, wut? What about about race conditions, null pointers indirectly propagated into functions that don't expect null, aliased pointers indirectly propagated into `restrict` functions, and the other non-local UB causes? Sadly, C's e…

Even ignoring undefined behavior and nulls, everything in C is mutable. Action at a distance is basically the norm.

Re: A Rust shaped hole

#147
post #131

Earlier quoted context omitted.

C++'s complexity is coming from how eager it is to let you shoot yourself in the foot. Rust will make you sweat blood to prove the bird in the sky you're shooting at is really not your own foot.

You sure it doesn’t come from, for example, needing a macro just to get the length of an array?

Yes, I think it's pretty easy to be sure that this isn't where the complexity comes from when there's literally a method to do that on arrays. I'm not even sure which language you're talking about here, because you can call `.len()` in Rust or `.size()` in C++.

If you're trying to remember what the language is where there's no immediately obvious straightforward way to get the length of an array, it's not Rust or C++; you must have been thinking of C.

Re: A Rust shaped hole

#148

Earlier quoted context omitted.

I've seen this idea from a few people and I don't get it at all. Rust is certainly not the simplest language you'll run into, but C++ is incredibly baroque, they're not really comparable on this axis. One difference which is already important and I think will grow only more important over time is that Rust's Editions give it permission to go back and fix things, so it does - where in C++ it's like venturing into a ho…

C++ has editions too btw. C++11, C++14, C++17, etc. These are opt in and allowed to break compatibility, although that is very rarely done in practice.

> although that is very rarely done in practice.

That's one difference. And the other important differences are:

- Rust apps can depend on library "headers" written in other editions. That's the whole deal with editions! Breaking changes are local to your own code and don't fracture the ecosystem.

- Rust has a built-in tool that automatically migrates your code to the next edition while preserving its behavior. In C++, upgrading to the next standard is left as an exercise for the reader (just like everything else). And that's why it's done so rarely and so slowly.

Re: A Rust shaped hole

#149

Earlier quoted context omitted.

I've seen this idea from a few people and I don't get it at all. Rust is certainly not the simplest language you'll run into, but C++ is incredibly baroque, they're not really comparable on this axis. One difference which is already important and I think will grow only more important over time is that Rust's Editions give it permission to go back and fix things, so it does - where in C++ it's like venturing into a ho…

C++ has editions too btw. C++11, C++14, C++17, etc. These are opt in and allowed to break compatibility, although that is very rarely done in practice.

C++ shipping new and slightly incompatible versions of the entire language every three years isn't Editions, there was a proposal to attempt Editions (under the name "Epochs") for C++ but it faced significant headwinds and was abandoned.

Re: A Rust shaped hole

#150
post #94

If they're serious about their criteria they should go with OCaml (or maybe, like, Swift, or any of dozens of languages in that space). (Of course they actually do want Haskell but they probably need to get there gradually)

Does ocaml have a mature ecosystem of libraries and dependencies? And easy way to manage them? Even rust with all its hype lacks in this area imo.
Post reply on HN