Rant after trying Rust a bit

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 22 12:41:14 PDT 2015


On Wednesday, 22 July 2015 at 18:47:33 UTC, simendsjo wrote:
> I've been using D on and off since 2007, and the lack of 
> manpower shows in every aspect of the language, design and 
> ecosystem. Rust has a pretty nice ecosystem and tools given its 
> very young age.

Only one way to fix this. Volunteer.

> Rust has a default package manager much like Dub. The main 
> difference is that Cargo has been endorsed by the Rust team and 
> is an official product. This means it works very well with the 
> compiler and feels like an integrated part of the language. 
> Dub, on the other hand, is a product from the outside, and 
> unfortunately, it feels this way too. Having Dub become the 
> endorsed package manager for D sounds like a very good idea for 
> me.

Dub is endorsed by the leadership and is included in the same 
Github organization as the complier and the standard library

> While code.dlang.org has 530 packages, crates.io has 2610 
> packages, and this is even if Rust is very new. Dubs repository 
> website is a lot better than Rusts though :)

I attribute this to hype. Also, while dub may feel a little bare 
at times, I always think of the worse alternative in node, so 
many packages that are crap that they push out anything of value.

> Traits
> ------
> I think the ability to express an interface without buying into 
> inheritance is the right move. The alternative in D is 
> specifying the behavior as a template and verifying the 
> contract in a unittest for the type.

I don't know enough about rust to comment.

> Macros
> ------
> I haven't written more than extremely simple macros in Rust, 
> but having macros that is possible for tools to understand is a 
> win.  Templates and string mixins is often used for this 
> purpose, but trying to build tools when string mixins exists is 
> probably extremely hard. If D had hygenic macros, I expect 
> several features could be expressed with this instead of string 
> mixins, making tooling easier to implement.

Maybe tooling would become easier to write, but in my personal 
experience, macros are much harder for programmers to understand 
than mixins, and much easier to abuse.

> Safe by default
> ---------------
> D is often said being safe by default, but D still has default 
> nullable references and mutable by default. I don't see it 
> being possible to change at this stage, but expressing when I 
> want to be unsafe rather than the opposite is very nice. I end 
> up typing a lot more in D than Rust because of this.

This would break so much code it's not even funny. I agree that 
immutable by default is the best paradigm, but as far as breaking 
changes go, you can only have so many before people abandoned a 
language.

> Expressions
> -----------
> This probably also falls in the "too late" category, but 
> statements-as-expressions is really nice. `auto a = if ...` <- 
> why not?

Don't quite know what you mean here.

> Borrowing
> ---------
> This is probably the big thing that makes Rust really 
> different.  Everything is a resource, and resources have an 
> owner and a lifetime. As a part of this, you can either have 
> multiple aliases with read-only references, or a single 
> reference with a writeable reference. I won't say I have a lot 
> of experience with this, but it seems like it's not an 
> extremely unergonomic trade-off. I cannot even remotely imagine 
> the amount of possible compiler optimizations possible with 
> this feature.

I think that someone was working on this, but I think it got 
sidelined (as it should) to fixing RefCounted and other things in 
the std lib.

> The constant breakage in the language and standard library 
> haven't been an real issue for me as I haven't used it in 
> production - the problem when I used it was partly the phobos 
> vs tango with incompatible runtimes together with an extremely 
> buggy compiler.

The tango vs Phobos issue has been mostly settled after the 
transition from d1 to d2, and the complier is a lot better now 
than it was.

> On the breaking part, the real issue is the "We're not going to 
> break any code!" stance,

Who, in the leadership or a contributor, has ever said this.


More information about the Digitalmars-d mailing list