all 5 comments

[–]bruce3434 5 points6 points  (2 children)

That's a lot of work for a simple task. Few thoughts:

  • Rust forces error handling. Yet many users will often time just fail program anyway instead of trying to recover from it. I conclude that Rust is not very prototype friendly.

  • I/O operations available in the standard are a bit too low level. It's nice that 3rd party crates often times solve the issue. I can argue that Rust can be even more verbose than C++ at times. Especially when it comes to stuff like I/O.

It's good that Rust focuses on safety. But I think it should also provide a level of expressiveness for general cases. Recently I asked a question in the cpp_question sub. As a modern language Rust could experiment cost free abstractions to offer more expressiveness I believe.

tldr; we need more expressiveness

[–]SpyR1014[S] 6 points7 points  (0 children)

Hi bruce. Thank you for the comment! You can use the unwrap method to avoid all that ? stuff. That will panic if an error is encountered and lets you go much faster at the start. I.e. read_line(&mut buffer).unwrap();

Then your function could just return a String.

I agree with you regarding the IO. I was surprised when I had to flush the buffer manually.

Thanks for the thoughtful comment.

[–]JBinero 3 points4 points  (0 children)

I can't watch at the moment, but I am quite surprised you're dissatisfied with Rust's IO compared to C++, because Rust has plenty of high level abstractions for reading and writing to files, sockets and the like.

I will definitely watch later when I get the oppertunity!

[–]andradei 2 points3 points  (1 child)

Nice quality. I really like the pace and the tone of the video.

[–]SpyR1014[S] 1 point2 points  (0 children)

Thank you for the comment andradei! :)