www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - A comparison between Rust and D

reply maik klein <maikklein googlemail.com> writes:
https://maikklein.github.io/post/cmp-rust-d/

https://www.reddit.com/r/programming/comments/4po2j5/a_comparison_between_rust_and_d/
Jun 24 2016
next sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Friday, 24 June 2016 at 17:26:58 UTC, maik klein wrote:
 https://maikklein.github.io/post/cmp-rust-d/

 https://www.reddit.com/r/programming/comments/4po2j5/a_comparison_between_rust_and_d/
On interior mutability in arrays, does this help: void main() { immutable(int)[] x = [1, 2, 3]; x = [2, 3, 4]; //this works x[0] = 1; //this doesn't immutable(int[]) y = [1, 2, 3]; y = [2, 3, 4]; //this doesn't y[0] = 1; //this doesn't }
Jun 24 2016
parent maik klein <maikklein googlemail.com> writes:
On Friday, 24 June 2016 at 17:37:20 UTC, jmh530 wrote:
 On Friday, 24 June 2016 at 17:26:58 UTC, maik klein wrote:
 https://maikklein.github.io/post/cmp-rust-d/

 https://www.reddit.com/r/programming/comments/4po2j5/a_comparison_between_rust_and_d/
On interior mutability in arrays, does this help: void main() { immutable(int)[] x = [1, 2, 3]; x = [2, 3, 4]; //this works x[0] = 1; //this doesn't immutable(int[]) y = [1, 2, 3]; y = [2, 3, 4]; //this doesn't y[0] = 1; //this doesn't }
I should probably be more clearer, I this context I just meant std.container.Array. And in general stuff like refcounted. I wonder how Andrej handles immutability for the refcounted string.
Jun 24 2016
prev sibling next sibling parent Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Friday, 24 June 2016 at 17:26:58 UTC, maik klein wrote:
 https://maikklein.github.io/post/cmp-rust-d/

 https://www.reddit.com/r/programming/comments/4po2j5/a_comparison_between_rust_and_d/
It is a good thing to have objective comparisons of languages, but I think it would be more interesting if you only compared the languages and not the libraries as well. Comparing libraries is very tricky, and comparing standard libraries will usually end up with comparing apples and oranges as some languages intentionally keep their standard libraries small (as they should ;-).
Jun 24 2016
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 24/06/16 19:26, maik klein wrote:
 https://maikklein.github.io/post/cmp-rust-d/

 https://www.reddit.com/r/programming/comments/4po2j5/a_comparison_between_rust_and_d/
It's possible in D to collect multiple functions for one set of constraints using a template: template Foo(T) if (is(T : int)) { void a(T x) {} void b(T y) {} } -- /Jacob Carlborg
Jun 26 2016