Live data from Hacker News

Why is Rust difficult?

vorner.github.io

131–140 of 260 posts

Re: Why is Rust difficult?

#131
post #114
post #62

Earlier quoted context omitted.

> I think that we could find ways to make equally memory-safe languages that go about enforcing safety in entirely different manners than with ownership and lifetime semantics. Of course, but at the cost of requiring a garbage collector. Mandatory GC has three main drawbacks: * It makes it harder and much less convenient to call libraries in this language from other languages. * Low-resource embedded systems are a no…

Why does GC make it harder to call libraries in other languages?

What I meant was: If language X needs a GC, then writing a library in X makes it difficult and very inconvenient to use that library from another language.

The comments of jonathanstrange and humanrebar are also spot-on.

Re: Why is Rust difficult?

#132

Earlier quoted context omitted.

Comparison of a sensor fusion algorithm the likes of which are used in quadcopters: | impl | c | py3 | mpy | pypy3 | cy3 | |------|-------|--------|---------|-------|-------| | [ns] | 0.176 | 11.462 | 37.633 | 0.818 | 0.590 | | .c | 1.000 | 65.126 | 213.824 | 4.648 | 3.352 | mpy - MicroPython cy3 - Cython So, ... low resource can't run heavy languages fast (yet?). Good thing is by using MicroPython and writing the ti…

If you add two spaces in front of each line, it formats as monospace. Like this: | impl | c | py3 | mpy | pypy3 | cy3 | |------|-------|--------|---------|-------|-------| | [ns] | 0.176 | 11.462 | 37.633 | 0.818 | 0.590 | | .c | 1.000 | 65.126 | 213.824 | 4.648 | 3.352 | Also, I'm taking a guess here and assuming that the values in the second line mean "execution time as multiples of the execution time for C".

Yes, it was `*c`, but the star screwed up formatting even more ;)

Re: Why is Rust difficult?

#133
post #114
post #62

Earlier quoted context omitted.

> I think that we could find ways to make equally memory-safe languages that go about enforcing safety in entirely different manners than with ownership and lifetime semantics. Of course, but at the cost of requiring a garbage collector. Mandatory GC has three main drawbacks: * It makes it harder and much less convenient to call libraries in this language from other languages. * Low-resource embedded systems are a no…

Why does GC make it harder to call libraries in other languages?

When you're working in a GCed language you assume your language's GC is responsible for freeing memory. When you interoperate with a language where owners are responsible for freeing memory, you have to have a way to "disown" structures you've created but passed into the ownership language (e.g. a callback you've passed to a library function) so that your GC doesn't free them, and a way to "own" structures you've received from the ownership language (e.g. values returned from library functions) so that your GC does free them, and neither of these things will be easy/natural in your language.

When you interoperate with another GCed language it's even harder, virtually impossible, because both languages' GCs assume they own everything and so anything that's visible in both languages will be freed twice.

Re: Why is Rust difficult?

#134

Earlier quoted context omitted.

> I would normally define 'correctness' to include rigorous mathematical proofs. Do you have an example of a language that does what you're looking for? On the proof side, Rust's built in unit testing is great, and allows for quick validation of code (proofs). But I think you mean something different. > Go works wonderfully Go does work wonderfully, you should definitely use what you like. For me personally, though,…

> Do you have an example of a language that does what you're looking for? Dependently typed programming languages such as Coq and Idris let you write proofs about your programs. These languages are fairly academic, and most engineers probably won't find it worthwhile to use these tools. Personally, I love them. I wrote a short article about my experience with Coq: https://www.stephanboyer.com/post/134/my-unusual-hobb…

Rust has the same level of rigour, other than lacking totality. Not having dependent types makes properties a lot more cumbersome and less practical to encode, but the actual proofs you get of the properties you do model are just as valid as those in Coq and Idris (modulo nontermination).

Re: Why is Rust difficult?

#135
post #37

I like Rust so far, but there's a few things I think aren't true: * That Rust is only harder because it enforces 'correctness.' It certainly is harder because it enforces correctness, but it's also harder because of how . I'm not saying there's a better approach to this, but I think a lot of people are implying that there isn't, and I don't think that's a safe assumption. I think that we could find ways to make equal…

As an occasional Ada programmer, I've taken a look several times at Rust and have decided to skip it every time. Ada might be a pain in the ass sometimes (alias rules...), but it's way easier than Rust. In my opinion Rust is a classical case of technology that gets into humans' way rather than serving humans. For me it's just not worth the hassle, especially since most of my programs do not require any soft realtime…

I didn't program ADA, but reading the ADA intro has left me with a good impression of the language.

It's focused on safety even more than Rust and yet it has kept an understandable syntax.

Re: Why is Rust difficult?

#136

Earlier quoted context omitted.

You make some good points but I think it's incorrect to compare Rust & Go. Rust is a systems programming language. It competes with C/C++ more than other high-level languages. In fact, while Go was originally positioned as a systems language but it ended up attracting people from scripting languages like Python because its performance characteristics put it there. You'd probably never bother building a serious web br…

> As for compiler errors not helping you understand the problem, I have yet to encounter a compiler that does that. Not very mainstream, but take a loot at elm's compiler errors [1]. They worked hard in this direction, and the result is both helpful and beautiful. You can try loading up any of the examples in the online editor [2] and introducing a random bug, just to see how the compiler barks tries to gently teach…

The error message catalogue [1] mentioned at the end of that first blog is interesting, wonder if Rust would benefit from something similar.

[1] https://github.com/elm-lang/error-message-catalog

Re: Why is Rust difficult?

#137
post #136

Earlier quoted context omitted.

> As for compiler errors not helping you understand the problem, I have yet to encounter a compiler that does that. Not very mainstream, but take a loot at elm's compiler errors [1]. They worked hard in this direction, and the result is both helpful and beautiful. You can try loading up any of the examples in the online editor [2] and introducing a random bug, just to see how the compiler barks tries to gently teach…

The error message catalogue [1] mentioned at the end of that first blog is interesting, wonder if Rust would benefit from something similar. [1] https://github.com/elm-lang/error-message-catalog

Rust has a strong policy of adding tests when adding/changing code, so almost all error messages are tested in some form, including "UI" tests, that check the exact formatting.

Additionally, there's https://doc.rust-lang.org/error-index.html

Re: Why is Rust difficult?

#138

Earlier quoted context omitted.

You make some good points but I think it's incorrect to compare Rust & Go. Rust is a systems programming language. It competes with C/C++ more than other high-level languages. In fact, while Go was originally positioned as a systems language but it ended up attracting people from scripting languages like Python because its performance characteristics put it there. You'd probably never bother building a serious web br…

> As for compiler errors not helping you understand the problem, I have yet to encounter a compiler that does that. Not very mainstream, but take a loot at elm's compiler errors [1]. They worked hard in this direction, and the result is both helpful and beautiful. You can try loading up any of the examples in the online editor [2] and introducing a random bug, just to see how the compiler barks tries to gently teach…

[deleted]

Re: Why is Rust difficult?

#139

Earlier quoted context omitted.

You make some good points but I think it's incorrect to compare Rust & Go. Rust is a systems programming language. It competes with C/C++ more than other high-level languages. In fact, while Go was originally positioned as a systems language but it ended up attracting people from scripting languages like Python because its performance characteristics put it there. You'd probably never bother building a serious web br…

> As for compiler errors not helping you understand the problem, I have yet to encounter a compiler that does that. Not very mainstream, but take a loot at elm's compiler errors [1]. They worked hard in this direction, and the result is both helpful and beautiful. You can try loading up any of the examples in the online editor [2] and introducing a random bug, just to see how the compiler barks tries to gently teach…

Rust's error messages are (well, try to be) similar, and in fact explicitly inspired by Elm: https://blog.rust-lang.org/2016/08/10/Shape-of-errors-to-com...

Re: Why is Rust difficult?

#140
could someone point to the article explaining how Rust compiler reasons about the program, how different kinds of objects and pointers are represented in runtime - in a word, something that would help me grasp what is really going on when I compile and run the program. The tutorials I saw are written in assumption that you don't need to know that. Which makes me feel like a total idiot
Post reply on HN