Rant after trying Rust a bit
Tofu Ninja via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 24 13:46:05 PDT 2015
On Friday, 24 July 2015 at 13:22:34 UTC, Jacob Carlborg wrote:
> On 2015-07-24 02:55, Tofu Ninja wrote:
>
>> I think I agree on the if else issue, seems arbitrary as we
>> already have
>> ?:. Other statements as expressions have less obvious
>> meanings. The only
>> part is that I wish you could have blocks as expressions. The
>> thing is
>> with ufcs, it really should be possible.
>>
>> For example the following does not compile:
>> int a = {return 4;};
>>
>> but the following does:
>> int a = {return 4;}();
>>
>> I know it's a really small difference, but with UFCS, I would
>> expect you
>> the be able to omit the () and have the function literal called
>> automatically. Though I can see that this would have problems
>> with auto
>> and knowing if it should be a function pointer or to call the
>> function.
>>
>> I guess what I would expect is "auto a = {return 4;};" to type
>> a to a
>> function pointer, but if you explicitly type a to int then the
>> literal
>> should be called.
>>
>> Does UFCS even apply to function pointers? I guess it is a
>> problem, it
>> does not seem to be obvious when to call and when to copy the
>> pointer. I
>> don't really know what should happen. I think I read a dip a
>> little
>> while ago that might have addressed this, but I don't really
>> remember. I
>> dont know, now that I have written this, it seems to have more
>> problems
>> than I originally thought.
>
> How does UFCS apply here? There isn't even a dot in the code.
Is omitting the () not part of ufcs? Or does it have some other
name, I can never remember.
More information about the Digitalmars-d
mailing list