3 ms·
I can help with a Rust vs ATS. 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 memo
by doublec 11y ago
I can help with a Rust vs ATS.
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.
- kibwen 11y agoThis is awesome, I'm so happy to finally hear from somebody with experience in ATS. :) > 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...
- doublec 11y agoI much prefer explicit over implicit so I'm not a big fan of RAII. I find it hides things that are happening in the code which makes it hard to find performance and other problems from inspection. ATS has tail call optimisation and destructors would make it hard to tell when TCO can't be done due to the hidden destructor calls. 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-memory-in-ats.html http://bluishcoder.co.nz/2012/08/30/safer-handling-of-c-memo...