Questions tagged [rust]
For questions about design of, or languages which are closely related to, Rust, a strongly-typed, memory-safe, expression-oriented language.
23 questions
-2
votes
2
answers
216
views
Parallel like CUDA, safe like Rust [closed]
CUDA excels at parallel programming, but is primarily marketed for programming languages that have certain disadvantages compared to Rust, for example in terms of safety (C, C++) or speed (Python).
...
5
votes
3
answers
1k
views
How are existential types different from Rust's traits?
I am investigating ways to add some form of abstract data types to a toy language.
I was reading Graydon Hoare's The Rust I Wanted Had No Future, in which he talks about existential types. I have not ...
7
votes
0
answers
358
views
What languages provide static guarantees about race conditions?
What programming languages provide significant static guarantees about race conditions (with respect to memory safety), and what guarantees do they provide?
I am aware that Rust provides some ...
14
votes
2
answers
1k
views
In Rust, why did the designers choose to make drop take &mut self instead of self
In Rust, the Drop trait is defined like this:
trait Drop {
fn drop(&mut self);
}
This has a number of issues:
If you ...
11
votes
5
answers
936
views
Why don't languages do automatic pimpl?
In the C++ community, there is a well know compilation cascade problem, that can be solved with the pimpl ideom https://herbsutter.com/gotw/_100/
Here's the problem: If you nest structs (with each ...
3
votes
2
answers
447
views
Does a Rust implementation of the Monkey programming language require a garbage collector?
Awhile back I wrote a Rust implementation of the Monkey programming language by Thorsten Ball (https://monkeylang.org/). When I got done with it I was a bit surprised that I never used an Arc/Rc ...
1
vote
1
answer
201
views
Implementing automatic derivation without macros?
In Rust:
#[derive(Display)]
struct Foo<T>(T);
If T conforms to the Display trait, ...
39
votes
2
answers
23k
views
Why do common Rust packages depend on C code?
Chapter 1 of "The Rust Programming Language" (Klabnik and Nichols) says:
[S]ome common Rust packages depend on C code and will need a C compiler.
Why do Rust packages have any dependency ...
13
votes
1
answer
2k
views
What is the difference between GAT and HKT?
I implemented a basic generics-free, parameterless trait (type class) system. And I want to parameterize my trait system. The alternative paths I know of are Generic Associated Types (GAT) and Higher-...
14
votes
1
answer
1k
views
Is there a difference between Rust's `macro_rules!` and Scheme's `syntax-rules`?
This is an example for the use of Rust's macro_rules!:
...
9
votes
1
answer
800
views
How does Rust parse ambiguous macros?
Rust's macros require them to be delimited by either parentheses, braces, or brackets, such as println!(arg) or foo! { bar, baz }...
31
votes
3
answers
13k
views
Why did Rust require macro names to have an exclamation point at the end?
Why did the designers of the Rust programming language require that macro names have to end with an exclamation point?
I observe that both Common Lisp and Emacs Lisp language variants do not appear, ...
8
votes
4
answers
5k
views
Does using Rust eliminate the need to implement garbage collection in a language?
I am new to language development. I am aware of Rust's ownership model that builds programs in a way that does not need garbage collection.
So if I am to build a new programming language using safe ...
21
votes
4
answers
9k
views
Why does Rust choose not to provide `for` comprehensions?
Okay, so this might be a silly question. I'm a big fan of functional programming paradigms in higher-level scripting languages, so I'm probably using Rust wrong. However, I'm new to Rust and I'm ...
3
votes
1
answer
364
views
How can I design a Functor trait to handle trait?
In programming languages like Rust, variables of different types that implement the same trait can have different sizes, i.e., the number of bytes used in the memory representation of the type. For ...