Rant after trying Rust a bit
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 23 08:41:16 PDT 2015
On Thursday, 23 July 2015 at 14:49:55 UTC, ixid wrote:
> On Thursday, 23 July 2015 at 13:33:43 UTC, Adam D. Ruppe wrote:
>> On Wednesday, 22 July 2015 at 21:04:57 UTC, simendsjo wrote:
>>> :) The example was written to save space. I recon you
>>> understand what I mean.
>>
>> Yeah, but the if/else is one of the most useful examples of
>> it, and is covered by ?:, so the whole thing becomes less
>> compelling then.
>>
>> The other places where I've used it in languages that support
>> it are little blocks crammed into a line and sometimes
>> exception grabbing... but still, the value isn't that great.
>
> If we had a clean sheet wouldn't it be better to have if return
> a value and ditch ternary?
Maybe, but the ternary operator is a lot less verbose, and from
some other comments in this thread, it sounds like the way they
implemented it in Rust forces you to use braces for single line
statements, which would be a _huge_ downside IMHO. I'm inclined
to think that it would need a use case that's a lot more
compelling than if-else chains to be worth it.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list