On Friday, 29 January 2016 at 15:39:53 UTC, bearophile wrote:
qznc:
On Friday, 29 January 2016 at 09:00:52 UTC, qznc wrote:
D is a broader language and is applicable in more situations.
In many cases you don't care and don't want to care about
memory management.
Learning to manage memory in Rust takes lot of time and
practice, it's a bit painful. I am sometimes able to write
working D code almost as quickly as Python code, but writing
similar code in Rust takes me much more time.
So I think for both small script-like programs, and general
application code (where code safety is not the most important
thing), D wins over Rust.
D is also more flexible (higher order templates, better CTFE,
unrestricted UFCS, etc), and you can port Python or C code to D
faster than to Rust.
So I think Rust targets a smaller number of coding purposes
compared to D. Rust could also replace the code you want to
write in OcaML, like compiler-like programs (thanks to Rust
enums and pattern matching).
Safety and correctness of the code are very important for me.
Regarding safety & correctness I think there's this ordering:
Rust > D > C++14 > C
If you talk about correctness you think about Ada too. Rust
code seems usually more succinct compared to Ada code. Ada is
more mature and it has lot of small features missing from
Rust/D, that help make the code more correct (like integer
subsets, static invariants, stronger typing for array indexing,
SPARK annotations to manage global mutables safely, and so on).
I don't know if such safety features will be added to Rust, I
am dubious.
In the C/Ada world you have language subsets like MISRA/SPARK
that people use in high integrity system. I think Rust still
lacks something like that.
Bye,
bearophile
Hi bearophile.
Welcome back.
I haven't used Ocaml, but was intrigued by it after seeing Yaron
Minsky's talks. To what extent can pattern matching, strong
types with invariants and other things Ocaml features be
implemented idiomatically in D? Eg I know D has invariants, but
that seems to be more a debug mode thing, and I am not sure if
they are doing the same as what Minsky described in his talk.
Bloomberg seem to use it for front end stuff as they open sourced
a Javascript back end for the Ocaml compiler (and that's not the
only such back end).
How productive do you find coding in Ada ?