Would anyone like to compare Rust to ATS instead? Maybe Erlang? Anybody??
Would anyone like to compare Rust to ATS instead? Maybe Erlang? Anybody??
ATS is more like a safe version of C wrapped in ML syntax vs Rust as a safe version of C++.
ATS is lower level. You can do memory safe pointer arithmetic whereas in Rust you'd use unsafe blocks.
Some things are implicit in Rust but explicit (and more verbose) in ATS. For example, Rust has destructors for RAII whereas ATS requires manually calling functions to clean up resources. The type checker tells you when you need to do this (via linear types) but programmer still needs to do the call.
Borrowing is automatic in Rust. In ATS it requires keeping track of borrows in proof variables and manually giving them back. Again the type checker tells you when you get it wrong but it's more verbosity.
ATS has a restricted form of dependent types - Rust is not dependently typed.
With current implementations, ATS compiles to C which can be compiled independantly of an ATS install. You can ship the C code to someone to build without them needing ATS. Rust uses LLVM.
The two languages feel very differently when programming.
> For example, Rust has destructors for RAII whereas ATS
> requires manually calling functions to clean up
> resources.
This especially intrigues me, as recent events have shaken my faith a little in RAII. Who knows, maybe Rust will one day regret not embracing linear types wholeheartedly...Another nice thing ATS has is the ability to specify the API for a C function to a level of detail that enables removing a whole class of erroneous usage of the C API. I have an example of this where I start with a basic API definition and tighten it up by adding type definitions:
http://bluishcoder.co.nz/2012/08/30/safer-handling-of-c-memo...