Rant after trying Rust a bit
QAston via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 23 09:22:28 PDT 2015
On Thursday, 23 July 2015 at 13:33:48 UTC, Andrei Alexandrescu
wrote:
> On 7/22/15 7:47 PM, rsw0x wrote:
>> On Wednesday, 22 July 2015 at 18:47:33 UTC, simendsjo wrote:
>>> ...
>>
>> I think rust makes the ugliness of D's "push everything into
>> phobos for
>> simplicity" become very visible. D and Rust share many equal
>> constructs,
>> but D's is almost always uglier.
>
> Care for a list? Thanks! -- Andrei
Ugliness is in the eyes of the beholder, for me for example is
kinda funny when people call D syntax better than Rust, for me
those are nearly the same (I do know lisp).
Back to topic:
Rust's compiler is aware of some traits and attributes:
http://doc.rust-lang.org/std/clone/trait.Clone.html which
disables move semantics
or other traits grouped here:
http://doc.rust-lang.org/std/marker/
This works sort of the way D compiler is aware of input ranges or
druntime for foreach and makes it possible to create alternative
standard libraries like https://github.com/carllerche/mio
D has equivalent capabilities in most cases, but it's way less
consistent in a way they're provided.
As an example: D has __traits + isExpressions + template
constraints phobos wrappers where Rust has trait:
http://doc.rust-lang.org/std/marker/trait.Reflect.html + template
constraints
D has some rules which types have size at compile time, Rust has
http://doc.rust-lang.org/std/marker/trait.Sized.html
D has rules for sharing certain types, Rust has
http://doc.rust-lang.org/std/marker/trait.Sync.html
D has operator overloading while Rust has that to, but using
traits: http://rustbyexample.com/trait/ops.html
D has special druntime Object type, Rust has a hash trait, cmp
trait http://doc.rust-lang.org/core/cmp/index.html
http://doc.rust-lang.org/core/hash/index.html which are more
elastic.
This is in no way deal breaker because things are there in D. On
the other hand learning is much easier because things are
consistent. First example did hurt me badly, juggling 6 docs
files for type introspection. That's what I think simendsjo meant
about "ugliness".
I think the reason for this "mess" in D is that D is developed in
a very ad hoc way, while for rust things really get peer reviewed
and tested for a long period of time.
More information about the Digitalmars-d
mailing list