Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Discussions about Rust sometimes feel quite pointless because you can be several replies deep with someone before realising that actually they don't know much about the language and their strongly-held opinion is based on vibes.




Exactly. Claims like "even without dealing with a single reference/borrow."

When you have this stuff in "Hello World":

Egui Hello World:

    ui.add(egui::Slider::new(&mut age, 0..=120).text("age"));
Ratatui Hello World:

    fn render(frame: &mut Frame) {
or

  fn run(mut terminal: DefaultTerminal) -> Result<()> {
      loop {
          terminal.draw(render)?;
          if matches!(event::read()?, Event::Key(_)) {
              break Ok(());
          }
      }
  }
And I didn't even break out the function chaining, closure and associated lifetime stuff that pervades the Rust GUI libraries.

When I can contrast this to say, ImGui C++:

  ImGui::Text("Hello, world %d", 123);
  if (ImGui::Button("Save"))
      MySaveFunction();
  ImGui::InputText("string", buf, IM_ARRAYSIZE(buf));
  ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
which looks just slightly above C with classes.

This kind of blindness makes me wonder about what universe the people doing "Well Ackshually" about Rust live in.

Rust very much has an enormous learning curve and it cannot be subsetted to simplify it due to both the language and the extensive usage of libraries via Cargo.

It is what it is--and may or may not be a valid tradeoff. But failing to at least acknowledge that will simply make people wonder about the competence of the people asserting otherwise.


> Exactly. Claims like "even without dealing with a single reference/borrow."

> When you have this stuff in "Hello World"

Might be worth reading simonask's comment more closely. They said (emphasis added):

> You can absolutely make _a_ complete, featureful program in Rust without naming a single lifetime, or even without dealing with a single reference/borrow.

That some programs require references/borrows/etc. doesn't mean that all programs require them.


I don't get your examples.

The rust code you pasted doesn't show any lifetime.

The `&f` in your imgui example is equivalent to the `&mut age`.

Are you just comparing the syntax? It just take a couple of hours to learn the syntax by following a tutorial and that `&mut` in rust is the same as `&` in C, not to mention that the compiler error tell you to add the `mut` if it is missing.

Also 0..=120 is much more clear than passing to arguments 0.0f, 1.0f. it makes it obvious what it is while looking at the imgui call it isn't.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: