4 ms·
Rust took affine substructural types and integrated them into a language that looks as similar to C and C++ as possible, to make it not seem foreign to your ave
by cm3 10y ago
Rust took affine substructural types and integrated them into a language that looks as similar to C and C++ as possible, to make it not seem foreign to your average programmer. You can think of Rust as a focused version of ATS2 with less features for practical reasons.
Rust is for building lower-level code which you would have written in C or C++ before. The comfort features and type system plus compiler support make it more amenable to writing application code as well, which would have been written in Java, C++ or Python out of comfort, so it's used for that, too.
OCaml is still relevant and they complement each other. Rust is decidedly not a functional programming language, so its type system isn't going to magically support expressing the kind of constraints and abstractions (for more maintainable and less bug-prone code) you're able to in OCaml, Haskell, or even ATS2. It's not Rust vs OCaml but Rust and OCaml.
The selling point of Rust over ATS2 or OCaml is the popularity and resulting ecosystem around it, just like the JVM.
OCaml's existing multicore story is practical with async and friends, but they're about to land the low-level framework that allows one to build various concurrency abstractions on top. That one's based on KC's research and is pretty cool, actually.
- catnaroek 10y agoasync is for concurrent I/O, not parallel processing.
- gpderetta 10y agoI don't know about ocaml, but in general async is also about parallelism as it exposes concurrency opportunities. See cilk spawn for example.
- catnaroek 10y agoParallelism and concurrency are fundamentally different things. Parallelism is running independent computations simultaneously. Concurrency control is managing the use of shared resources by temporarily granting exclusive access to them to individual computations. Imperative languages tend to blur the distinction between parallelism and concurrency, because the global state of a process by itself can be considered a shared resource. But in functional languages, it's natural to expect a sharper distinction: Because most data structures are logically immutable, the primary use for concurrency control is managing the interaction between the program and the “outside world”. On the other hand, parallelism is a powerful tool for speeding up the program's own internal calculations, even when no interaction with the “outside world” is involved.
- gpderetta 10y agoConcurrency is a property of the software (i.e. the problem domain): i.e. having multiple independent control flows. Parallelism is a property of the hardware, i.e. having the capability of running multiple operations (be it pure computation, memory access or IO). To make use of parallel hardware you need concurrent software. Async is a way of exposing additional concurrency, thus enabling parallelism, to the hardware.
- catnaroek 10y ago> Parallelism is a property of the hardware, i.e. having the capability of running multiple operations (be it pure computation, memory access or IO). Parallelism is a property of the program too: if it doesn't have independent subcomputations, the program is going to run sequentially even in hardware that supports parallelism. > To make use of parallel hardware you need concurrent software. Parallel Haskell shows otherwise.
- gpderetta 10y ago>if it doesn't have independent subcomputations, the program is going to be run sequentially even in hardware that supports parallelism. the property of having independent sub-computations is called concurrency.
- catnaroek 10y ago> the property of having independent sub-computations is called concurrency. Nope. If I have two n-dimensional vectors, and want to compute their sum, there's no concurrency whatsoever: there's just n independent computations (each scalar sum). A pure parallelism problem. (Well, there is a concurrency problem at a lower level of abstraction, if you want to schedule these computations over less than n processors. That's because the processors are shared resources that require temporary exclusive access to be used.) References: (0) https://existentialtype.wordpress.com/2011/03/17/parallelism-is-not-concurrency/ https://existentialtype.wordpress.com/2011/03/17/parallelism... (1) https://existentialtype.wordpress.com/2014/04/09/parallelism-and-concurrency-revisited/ https://existentialtype.wordpress.com/2014/04/09/parallelism...
- dorfsmay 10y agoIs ATS used at all outside academia?
- zem 10y agoyeah, here are some good posts on using ATS2 for internet-of-things applications http://metasepi.org/en/tags/ats.html http://metasepi.org/en/tags/ats.html