46
295
arendjr

@programming.dev

arendjr 44 points 2 years ago

Issue resolved

path: 0 12482129 12482153, hotness: undefined, score: 44, children: 1
arendjr 35 points a year ago

So far, the only good argument I have really seen from the ones opposing the Rust4Linux effort comes down to: adding Rust to a C codebase introduces a lot of complexity that is hard to deal with.

But the argument offers no solution except to give up and not even attempt to address the real issues the kernel struggles with. It’s effectively a form of defeatism when you want to give up and don’t want to let others attempt to do what you don’t see as feasible.

path: 0 15224889 15225207, hotness: undefined, score: 35, children: 11
arendjr 30 points 2 years ago

Using smart pointers doesn’t eliminate the memory safety issue, it merely addresses one aspect of it. Even with smart pointers, nothing is preventing you from passing references and using them after they’re freed.

path: 0 13203260 13205086, hotness: undefined, score: 30, children: 8
arendjr 28 points a year ago

I would argue that because C is so hard to program in, even the claim to machine efficiency is arguable. Yes, if you have infinite time for implementation, then C is among the most efficient, but then the same applies to C++, Rust and Zig too, because with infinite time any artificial hurdle can be cleared by the programmer.

In practice however, programmers have limited time. That means they need to use the tools of the language to save themselves time. Languages with higher levels of abstraction make it easier, not harder, to reach high performance, assuming the abstractions don’t provide too much overhead. C++, Rust and Zig all apply in this domain.

An example is the situation where you need a hash map or B-Tree map to implement efficient lookups. The languages with higher abstraction give you reusable, high performance options. The C programmer will need to either roll his own, which may not be an option if time Is limited, or choose a lower-performance alternative.

path: 0 17595624 17596187, hotness: undefined, score: 28, children: 15
arendjr 22 points 2 years ago

Of course, technically you can compile anything to almost anything. But I don’t think linking to a project that’s unmaintained for 15 years really helps your argument.

path: 0 9106403 9106514 9107364, hotness: undefined, score: 22, children: 3
arendjr 21 points a year ago

You’re implying that Linus is somehow responsible for burning out Marcan? I don’t think that’s a fair assessment.

path: 0 15221850 15225260, hotness: undefined, score: 21, children: 6
arendjr 19 points 5 months ago

Simple: if the toddler has found daddy’s gun because the safe was left open… you better try talking before you scare it.

path: 0 21568770 21568808, hotness: undefined, score: 19, children: 10
arendjr 19 points 2 years ago

I was aware that indeed the trait and lifetime bounds were an artifact of the Tokio work-stealing behavior, but Evan makes a very well-explained case for why we might want to consider stepping away from such behavior as a default in Rust. If anything, it makes me thankful the Rust team is taking a slow-and-steady approach to the whole async thing instead of just making Tokio part of the standard library as some have wished for. Hopefully this gets the consideration it deserves and we all end up with a more ergonomic solution in the end.

path: 0 12186520, hotness: undefined, score: 19, children: 0
arendjr 19 points 2 years ago

While I can get behind most of the advice here, I don’t actually like the conditions array. The reason being that each condition function now needs additional conditions to make sure it doesn’t overlap with the other condition functions. This was much more elegantly handled by the else clauses, since adding another condition to the array has now become a puzzle to verify the conditions remain non-overlapping.

path: 0 12533827, hotness: undefined, score: 19, children: 1
arendjr 19 points 2 years ago

Cool, that was an informative read!

If we were willing to leak memory, then we could write […] Box::leak(Box::new(0))

In this example, you could have just made a constant with value 0 and returned a reference to that. It would also have a 'static lifetime and there would be no leaking.

Why does nobody seem to be talking about this?

My guess is that the overlap in use cases between Rust and C# isn’t very large. Many places where Rust is making inroads (kernel and low-level libraries) are places where C# would be automatically disqualified because of the requirements for a runtime and garbage collection.

path: 0 13117048, hotness: undefined, score: 19, children: 11
arendjr 18 points 2 years ago path: 0 8868397, hotness: undefined, score: 18, children: 0
arendjr 17 points 2 years ago path: 0 10701768, hotness: undefined, score: 17, children: 1
arendjr 16 points 2 years ago

If we’re looking at it from a Rust angle anyway, I think there’s a second reason that OOP often becomes messy, but less so in Rust: Unlimited interior mutability. Rust’s borrow checker may be annoying at times, but it forces you to think about ownership and prevents you from stuffing statefulness where it shouldn’t be.

path: 0 12812211 12813067, hotness: undefined, score: 16, children: 9
arendjr 16 points 2 years ago

It’s a bit arguing about semantics really. But Rust and Haskell are merely the first ones with patches out. The issue affects other languages as well, including Java, Node.js, Python and seemingly every language with Windows support. I think it’s fair to call it a Windows problem, since it affects everyone there.

But languages like Rust and Haskell are promising their users that they are protected from this kind of behavior, which is why they want to patch it quickly. Some of the others merely updated the documentation, effectively saying yeah it’s a risk. Java went as far as saying they won’t fix the issue.

path: 0 9269839 9271491 9276578, hotness: undefined, score: 16, children: 0
arendjr 15 points 2 years ago

0° being “very cold” and 100° being “very hot” is intuitive.

As someone who’s not used to Fahrenheit I can tell you there’s nothing intuitive about it. How cold is “very cold” exactly? How hot is “very hot” exactly? Without clear references all the numbers in between are meaningless, which is exactly how I perceive any number in Fahrenfeit. Intuitive means that without knowing I should have an intuitive perception, but really there’s nothing to go on. I guess from your description 50°F should mean it’s comfortable? Does that mean I can go out in shorts and a t-shirt? It all seems guesswork.

path: 0 12140515 12141425 12145082, hotness: undefined, score: 15, children: 5
arendjr 15 points a year ago

That now involves fixing Rust drivers, so you’re going to need to know Rust.

I also don’t think the latter follows from the former. You can continue to not know Rust as long as you’re willing to work with those that can. Problems only start if you’re unwilling to collaborate.

path: 0 15224889 15225207 15225912 15226600, hotness: undefined, score: 15, children: 0
arendjr 15 points 2 years ago

I totally agree with this comment, and on top of that I would recommend anyone who really cares about the current state of affairs regarding safety in C++ to read this overview: https://accu.org/...

Quote:

Personally, I am not convinced that in the near future, C++ can do something to stop this trend. C++ will leak talent to other languages (currently Rust, but perhaps in the future to Cppfront, Carbon, Hylo or Swift). If the progress towards safety started in 2015 as Bjarne suggested, the last 8 years have seen very little progress in safety improvements. Even with accelerated efforts, the three-year release cycle and slow adoption of new standards will keep C++ a decade away from addressing major safety concerns.

path: 0 8617674 8621876, hotness: undefined, score: 15, children: 0
arendjr 15 points 2 years ago

Good question! 😂 maybe I’m overthinking it, but you seem to be making the point that it’s silly for people to like WASM based on the argument the JVM already exists and people are not fond of it/Java. If that’s not the point, why did you make the meme at all?

path: 0 9106403 9106514 9107364 9108082 9109064, hotness: undefined, score: 15, children: 1
arendjr 14 points 2 years ago

I would say at this point in time it’s clearly decided that Rust will be part of the future. Maybe there’s a meaningful place for Zig too, but that’s the only part that’s too early to tell.

If you think Zig still has a chance at overtaking Rust though, that’s very much wishful thinking. Zig isn’t memory safe, so any areas where security is paramount are out of reach for it. The industry isn’t going back in that direction.

I actually think Zig might still have a chance in game development, and maybe in specialized areas where Rust’s borrow checker cannot really help anyway, such as JIT compilers.

path: 0 12706743 12707168, hotness: undefined, score: 14, children: 3
arendjr 12 points 2 years ago

No, OP asked for a black and white winner. I was elaborating because I don’t think it’s that black and white, but if you want a singular answer I think it should be clear: Rust.

path: 0 12706743 12707168 12707259 12707366, hotness: undefined, score: 12, children: 1

thanks for using Leebra!

go to feed...