this post was submitted on 08 Sep 2023
0 points (NaN% liked)

Rust

7606 readers
9 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
top 3 comments
sorted by: hot top controversial new old
[–] BB_C@programming.dev 1 points 2 years ago* (last edited 2 years ago)

fn foo(&big, &chungus)

is out,

async fn foo(&BIG_GLOBAL_STATIC_REF_OR_SIMILAR_HORROR, sendable_chungus.clone())

is in.

Or maybe you know

fn foo(&big, &chungus)

is out

async fn foo(big, chungus) -> (big, chungus)

is in

Or

async fn foo(big, chungus) {
  // ...
  tx.send((big, chungus)).await?;
  // ...
}

is in

Moving (movable/sendable) data is not limited by number or direction, you know. And that second one even makes use of them great Hoare channels! And gives us control on how long we hold on to data before sending it back (modified or not). But I digress. Let's go back to the important talking point that Hoare was right!

[–] Cyberflunk@lemmy.world 0 points 2 years ago (1 children)
[–] BatmanAoD@programming.dev 1 points 2 years ago

Zig's approach seems even more low-level and manual: https://ziglearn.org/chapter-5/

(In general, I think Rust and Zig both seem valuable, and I think it's a mistake to treat programming language success as a zero-sum game.)