GwenStarlight

Producing lesbian demons since 1993

  • She/her They/them

TMA, multiply neurodivergent, ancient by internet standards, poylam and happily married.

I was on Cohost from 11/04/2022 until its last day (10/01/2024)


atax1a
@atax1a

#rustlang is a programming language from the early 2010s that uses techniques from programming language theory that were discovered sometime after 1970

this upsets nerds who think the only way to write a performant operating system is to write it in C, a literally conservative language from 1970 with very little compiler-time protection against memory corruption or type-check mismatches, because it means that they have to learn about something new, that prevents them from doing stupid things, because they think they just want to be able to do whatever they want without any safeguards or even a warning

rust stops an entire massive class of memory-corruption bugs by design, so of course fragile cis men who think they need control over every single thing hate it

like, we have beef with the rust programming language community at large, but the language itself is an untrammeled good and the more it replaces C, the better.


You must log in to comment.

in reply to @atax1a's post:

Agreed.

Re: the community, yeah, the evangelism part of the community gets to be a bit much. I don't regret that there are people excited about Rust, and that there's a lot of activity in the ecosystem, but sometimes they don't know how to contain their excitement.

:( seems a bit harsh to say that.. in my (admittedly somewhat brief) experience with Rust, a simple program with a main function that contains no lines of code produced a 9 mb executable...

A program with an empty main function, 9 entire megabytes, with a LOT of cpu instructions and different functions contained within....

C does this with just 10.4kb, the vast majority being the executable header, and the actual assembly has only one CPU instruction, which is understandably, Return from function

(to be fair i don't think i used optimizing flags, but i didn't use optimizing flags for C during this test either, plus Rust seems to benefit from adding a lot of utility functions for itself in the assembly)

Rust is likely rather useful! But it can't quite replace C, as unfortunately I can't use Rust for embedded software development D: code needs to be small on tiny chips

(edit: i stand corrected! read comment replies)

there is nothing inherent to rust that mandates this. you can use no_std and various bare declarations to get your code down to the embedded level, and still get all the benefits of the strong compile-time checks.

Agreeing with atax1a: the majority of the larger rust binaries are usually mostly from:

  • debuginfo (run strip to verify)
  • Not running in --release mode, debug is default and much larger in generated code. Debug mode in rust is often many orders of magnitude slower/larger than even -O1, rust benefits heavily from inlining to remove certain abstractions, and more safety checks (integer over/underflow, etc.) are on by default in debug mode.
  • Not dynamically linking as heavily as C does with libc

In bare metal embedded, is it very possible to get a hello world blinky down to 100s of bytes, and reasonably full firmwares in 1-10KiB, especially if you avoid string formatting.

There are a couple of guides that talk about analyzing/removing the extra bytes, but usually they are there for convenience, or nice to have a: like backtraces/stack traces on panics.

In general I would absolutely suggest learning something like Python or Rust before trying to learn C or C++. Ultimately though, the main thing you're trying to do is pick something which interests you long enough to learn. The actual language isn't that important so long as it brings you joy :)