proposal: short => rewrite for function declarations

Timon Gehr timon.gehr at gmx.ch
Sun Oct 11 15:38:26 UTC 2020


On 11.10.20 15:50, Adam D. Ruppe wrote:
> On Saturday, 10 October 2020 at 20:43:55 UTC, Steven Schveighoffer wrote:
>> 1. is short for:
>> (T)(T v) {
>>   return v.foo;
>> }
> 
> This technically isn't true... the lambda expression actually does 
> context-dependent magic that this template can't represent either.
> 
> Like that is *part* of its implementation detail, but there's more to it.
> 
> So since it is indeed impossible to duplicate its context-dependent 
> magic, I made it a parse error:
> 
> https://github.com/dlang/dmd/pull/11833/commits/acd15ce776af9bab336c14df20d77fbdc708e368 
> 
> 
> should be a happy enough compromise.

Just... why? Why add incidental complexity like this all? It's not like 
this has anything to do with the syntax of the lambda body. The original 
reasoning did not make any sense and this restriction is unnecessary.


More information about the Digitalmars-d mailing list