On 12-08-23 3:48 PM, Brian Anderson wrote:
Differences
* Unsafe sublanguage - Rust gives you low level control when you need it
* Control over memory layout - Local heap/echange heap/stack
* Iterators - Rust uses higher-order functions instead of iterator objects
* Expressiveness - Rust code is fairly compact. A determination to avoid
'public static void main' is the biggest influence of Java on Rust.
*laughs* that's possibly true -- we do tend to view Java (and Ada) as
verbosity high-water-marks to avoid -- but there are a few other
influences I can point out:
- Our liveness checker (and ex-typestate-system) are in some ways
similar to the definite assignment analysis in java.
- Our (creeping-into-existence) reflection layer, our existing
in-crate metadata, our somewhat draconian restrictions on
our own grammar, our attribute and doc-comment system and our
compiler-as-a-library and extension mechanisms in the compiler
are all at least partly inspired by the remarkable difference in
tool maturity and power between C++ and Java. We'd like the
language to be (eventually) as amenable to tooling as Java, or
as near as can be without requiring a byte-code IR.
- Rust has unsigned types, local type inference, disjoint unions,
tuples, a variety of "nicer" type-system things of this sort.
- We have tried to avoid a number of pain points we see in Java:
- Ubiquitous heap allocation
- Ubiquitous locking
- Virtual-by-default dispatch
- Finalizers rather than destructors
But really, the _main_ difference is the focus on ahead-of-time, native
compilation to standard executables and libraries, rather than bytecode
and managed runtimes / virtual machines / JITs. This decision influences
a _lot_ of the subsequent design tradeoffs.
Hth, and good luck!
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev