top | item 33167913

(no title)

acehreli | 3 years ago

It is definitely chewing on it. :)

D's advantage over Rust is its familiar syntax and semantics. C, C++, Java, C#, Python, etc. programmers feel at home once they learn some differences. I heard others say "D is what C++ should have been" and "Compiled Python".

I did use Rust for a brief period in a project where the experienced Rust programmer among us was throwing '&' characters here and there to make the code compile, seemingly randomly in many cases. Personally, I remember fighting with impedance issues with the many different string types of Rust. All of this spells a steeper learning curve to me.

I think D is familiar to programmers of many other languages.

discuss

order

Kranar|3 years ago

> Personally, I remember fighting with impedance issues with the many different string types of Rust.

It's because Rust gives very low-level control over strings. If what you want is a string the same way as they work in other languages, including D, then use String. If you want very fine control over memory allocation or want the string to be fixed length, then you use a type that guarantees those properties.

String will work with anything, at the cost of having little control over its allocation or representation.

glandium|3 years ago

The inconvenient truth about strings is that strings are hard, and even Rust doesn't have enough string types.

WalterBright|3 years ago

D doesn't actually have string types, either, what it does have is `string` is just an alias for:

    const(char)[]
meaning you can treat it like any other array.