Live data from Hacker News

Welcome to Comprehensive Rust

google.github.io

151–160 of 204 posts

Re: Welcome to Comprehensive Rust

#151

Earlier quoted context omitted.

People have picked stranger things than julia for safety critical control systems. I know people have generated it from simulink and have used labview, and it wouldn't surprise me if somewhere someone is using an excel macro to control the pressure system on a boiler... The world is a scary place. Reading theough the spark tutorials and examples seems fairly similar to the rustlings excercise. I find the ways spark p…

I started working with functional safety only two years ago, and I've been surprised when colleagues expressed that Simulink was actually the go-to solution for functional safety software where they were working before. The logic being that the Simulink toolchain is qualified for functional safety, and if you use it in combination with a qualified C toolchain and RTOS, then you're good to go, certification-wise.

My impression when working with people using Simulink is that 'safety' is much weaker that for people working on formal methods, and certification limited a lot the kind of programs that they would write. It made totally sense for their domain, but -- as a general practice to write software -- it didn't impress me at all. I may be wrong.

Re: Welcome to Comprehensive Rust

#152
post #31
post #22

Earlier quoted context omitted.

I'm tired of installation instructions that consist of "curl | sh". Especially since this one just tries to detect the platform and downloads the correct installer for me. I know what platform I'm running, and I don't want to pipe the internet to my shell. In the end this is unpacking a tarball in ~/.rustup, I don't need the risk of running some bespoke script for that.

Since the ultimate objective is to run a binary blob that you just downloaded off of the internet, piping a script to your shell over HTTPS adds no additional attack surface.

When I'm installing package from the repository, it's signed with GPG. Hopefully in a more secure place than WWW server. May be even at offline server with HSM (one can hope!). When I'm running code downloaded from HTTPS, all it takes is compromising this WWW server (or AWS Cloufront for this particular sh.rustup.rs example). HTTPS adds additional attack surface.

Re: Welcome to Comprehensive Rust

#153

The first thing I implore everyone to do when evaluating Rust is to check out a non trivial project and start hacking on it. I have always found the compiler to be unacceptably slow in these cases, especially if you come from C rather than C++. If you work your way up from Hello World you may not ever notice this until you already invested a substantial amount of effort.

I think this is good advice! But YMMV; I've also always found the compiler to be slow, but acceptably so for what it's giving me.

Re: Welcome to Comprehensive Rust

#154
post #148

Earlier quoted context omitted.

It's a property of basic RC but real-world RC based GC systems can often collect reference cycles. For example Python and PHP do this. (I'm sure you knew this, just adding to the discussion)

Rust doesn’t though. But it does make it much harder to leak memory than C. You need to create a cycle between reference counted objects versus just forget to free something. Not that it matters as much as people think. Memory leaks aren’t a correctness problem. You typically want to restart a program or service regularly anyway to deal with memory fragmentation. You also frequently have a watchdog like systemd to re…

Interesting view that memory leaks aren't correctness problems. But I would require more convincing to agree.

It's true that memory leaks can be small enough that they don't become problems in the end-to-end behaviour of the system in regular use. But a lot of bugs are like that. For example many memory safety bugs.

Re: Welcome to Comprehensive Rust

#155
post #8

Earlier quoted context omitted.

Slower compile times are a small price to pay for memory safety and much higher productivity.

I get those with Go and I have blazing fast compile times too.

Go isn't very safe and in general is a big mess with pointers and those zero-values. It gives you speed, a lot, but at a cost.

Re: Welcome to Comprehensive Rust

#156
post #63

Earlier quoted context omitted.

On the other hand, I've always found it surprisingly easy to dive into non-trivial rust projects and start contributing, at a speed that would be unthinkable in C or C++. So I second the advise for non-trivial projects, they give a much better idea of the upsides and downsides of rust.

Is that really due to the language or that we collectively have become better in structuring software projects?

Well, I've refactored large portions of Rust code with ease and I can't imagine doing it with any C/C++ code because I might break some invariant somewhere.

Re: Welcome to Comprehensive Rust

#157
post #108

Earlier quoted context omitted.

We developers love so much to learn computer stuff that we want to do it even when we don't need to. I worked on data science, computational science, some system engineering and embedded projects. I tried Rust on all of them but it was valuable only for the third. In data science the focus is more on speed of development and as much as Rust is more enjoyable to use than C++, it doesn't match scripting languages (name…

Rust still needs to do a lot of catching up in HPC, HFT, GUI, game engines, console SDKs, OS drivers on Apple and Microsoft OSes, Arduino, LLVM and GCC,... Rust threading is only safe between threads accessing data structures in process own memory. It does nothing for shared resources using OS IPC, or external resources shared among threads. It will certainly improve, as hopefully C++ will, even it never gets 100% as…

> Rust threading is only safe between threads accessing data structures in process own memory.

"Only". Intra-process shared memory is by far the most important kind of shared memory. 80% of the time you see someone advocating for message-passing multi-process over shared memory multi-thread concurrency or parallelism, it's because shared mutable memory is incredibly hard to get right in just about every mainstream language except for Rust.

> It does nothing for shared resources using OS IPC, or external resources shared among threads.

Only partially true. The very same language constructs which make shared memory safe can also be used to create safe wrappers for other shared resources.

Re: Welcome to Comprehensive Rust

#158
post #3

Is this “just” a 20% project or is this more significant (like Android one day supporting Rust to develop apps)? And I haven’t looked at everything yet, but it suggests to install Rust like this: sudo apt install cargo rust-src While everyone I know uses rustup^: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ^ https://rustup.rs/

I sit next to a guy in Mountain View that works full time just on teaching people Rust and integrating Rust into Android. There’s a whole team dedicated to getting Android developers writing Rust.

The difference in installation procedure is probably a security measure. Piping curl to bash is a bad move and it’s the Android security department that’s pushing Rust in Android. Plus, internally, Google has well maintained aptitude repositories with projects built from HEAD. It’s nice installing something like lldb from the command line and the internal Python interpreter is the latest version. And you know all of your coworkers are running that version, too.

Re: Welcome to Comprehensive Rust

#159
post #126

Earlier quoted context omitted.

That’s underselling it quite a lot. Rust has a number of features (ergonomic and technical) and some really nice language design that permits writing quite “high-level” code. Personally, having a compiler and type system as powerful as Rusts makes it worthwhile alone.

Most of those features are available in ML derived languages, without having to deal with Rust features that make it usefull C and C++ replacement. With faster compiler toolchains and REPL like tooling.

The trend is to just assume that using GC is off the table, without that being driven by any actual requirements or measurements.

Re: Welcome to Comprehensive Rust

#160
post #118

Earlier quoted context omitted.

The bash timing exploit makes everyone focus just on how cleverly evil it can be, and forget the big picture that it's about trusting the Rust org not to screw you. (BTW, you can run `curl | sh` in a VM or with a modified bash to intercept the code and catch the bash script in the act, so it's not actually as sneaky as people believe). If you think the Rust org is going to pwn you in a clever sneaky way, then you can…

"Trusting the Rust org not to screw you" is one part, another part is trusting the Rust server operators to defend against server compromise by any third party. So trusting the intentions is not sufficient.

The same thing applies to any binaries downloaded from their site, so unless you you've got signed binaries (that use an independently obtained/verified chain of trust), trusting the server is your your only option. Even with signed binaries, you're still trusting the entity that holds the signing key.
Post reply on HN