Rant after trying Rust a bit

shannon mackey via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 23 08:37:22 PDT 2015


"> On Wednesday, 22 July 2015 at 19:41:16 UTC, Jack Stouffer 
wrote:
On Wednesday, 22 July 2015 at 20:43:04 UTC, simendsjo wrote:
>> On Wednesday, 22 July 2015 at 18:47:33 UTC, simendsjo wrote:
>>> 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.
>
> When "everything" is an expressions, you can write things like
>     auto a = if(e) c else d;
>
> In D you have to write
>     type a = invalid_value;
>     if(e) a = c;
>     else  a = d;
>     assert(a != invalid_value);
>"

I frequently do things like this in D:

         auto good = ( true == true ) ? "true" : "false";

which looks a lot like your Rust example?  Is that not what you 
were looking for?


More information about the Digitalmars-d mailing list