Rant after trying Rust a bit

via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 2 20:17:10 PDT 2015


On Sunday, 2 August 2015 at 21:17:10 UTC, Jonathan M Davis wrote:
> types you're dealing with, and it allows user-defined code to 
> have both an addition operator and a concatenation operator on 
> the same type.

I assume you mean vectors, though I would prefer binary "++" for 
that.

> Where distinguishing between + and ~ would likely make a big 
> difference though is dynamic languages that aren't strict with 
> types and allow nonsense like "5" + 2. And in that case, I 
> expect that Walter is completely right. It's just error-prone 
> to use + for concatenation in cases like that, and providing a 
> separate concatenation operator would reduce bugs.

I've never run into such bugs, have you? The ambigious case
would be "result:" + 3 + 8 , but you can solve this by giving 
numeric plus higher precedence or avoid implicit conversion. 
Though, these days it is more common to support something like 
"result: {{3+8}}".

> Regardless, I definitely like the fact that we have ~ and ~= 
> instead of reusing + and += for that. It's a small improvement, 
> but it is an improvement.

It's a weird thing to do for a C-decendant as I would expect "~=" 
to do binary negation.





More information about the Digitalmars-d mailing list