[-] snaggen@programming.dev 1 points 2 years ago* (last edited 2 years ago)

Because of ownership you’re forced into certain hierarchies, which make the code ugly and hard to read.

For non-gc languages you always have ownership, in most languages you just have to keep track of it manually. And whenever the rust compiler gives an error, you would most likely have had a future issue in another language. For gc languages, this may still exist if you share data between threads, causing possilbe race conditions and data corruption. So, the ownership/borrow model is just a formalization of implicit rules that exists in most languages.

[-] snaggen@programming.dev 1 points 2 years ago* (last edited 2 years ago)

wouldn't it be better to use #[cfg(target_os = "windows")] instead of checking an env variable?

Reference: https://doc.rust-lang.org/rust-by-example/attribute/cfg.html

[-] snaggen@programming.dev 1 points 2 years ago

Yes, you have a point. However adding heat is often implicit when talking about melting stuff. However, if it requires 3400C, then the answer would probably include a comment about that.

44
46
28
24
6
submitted 2 years ago* (last edited 2 years ago) by snaggen@programming.dev to c/rust@programming.dev

Some context https://hachyderm.io/@Mara/111102308828739597

🦀 Have you ever purposely made use of the UnwindSafe or RefUnwindSafe traits in #rustlang?

I'm wondering if Rust would have been better off without these (somewhat confusing) traits.

29
Announcing Rust 1.72.1 (blog.rust-lang.org)
submitted 3 years ago* (last edited 3 years ago) by snaggen@programming.dev to c/rust@programming.dev

1.72.1 resolves a few regressions introduced in 1.72.0:

  • Partially revert codegen change, improving codegen

  • rustdoc: Fix self ty params in objects with lifetimes

    • Fix regression in compile times
    • Resolve some ICEs in the compiler: #115215 #115559
20
23
15
Rust Analyzer Changelog #199 (rust-analyzer.github.io)
25
30
41
[-] snaggen@programming.dev 1 points 3 years ago

Oh, hadn't seen the "Time travel debugging Rust in NeoVim" before, and I'm bad at using the debugger in vim so this is definitely something I must try out.

[-] snaggen@programming.dev 2 points 3 years ago

Traits are similar to an interface, but with some differences. Here is a comparison with Java interfaces https://stackoverflow.com/a/69485860

[-] snaggen@programming.dev 2 points 3 years ago

If you look at Rust for example, then you specify the Traits instead. So, you could define a trait that defines the properties for birth, another to define if the animal have a beak, and another one to define the number and type of legs. The each animal implement these traits, which then properly can define a duck, cat and a platypus.

[-] snaggen@programming.dev 1 points 3 years ago

Error stack will give will print the full stack of errors and their corresponding line in the code. Much like a backtrace, but for errors.

[-] snaggen@programming.dev 2 points 3 years ago

Yes, I started off with a C mindset and had a bit of a struggle the first days until the mental model of ownership and borrowing landed, after that it is mostly learning to use new concepts like pattern matching, the ? operator aso.

view more: ‹ prev next ›

snaggen

0 post score
0 comment score
joined 3 years ago