a lambda with arguments has type void?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 8 22:49:55 PDT 2016


On Thursday, 9 June 2016 at 05:20:46 UTC, cy wrote:
> On Tuesday, 7 June 2016 at 22:17:03 UTC, ag0aep6g wrote:
>> You don't specify the types of the parameters of the function 
>> literals, so you effectively have templates there. As such the 
>> literals have no types, and can't be passed as arguments.
>
> Yeah, I see that now. The compiler does have all the necessary 
> information to infer the argument types in both templates, 
> though. There's no reason that it /couldn't/ infer the type of 
> the argument.

yes, you can find alot of situations where it is theoretically 
possible to infer types (sometimes by doing several passes to 
"refine" the info), but dmd currently doesn't do that. partially 
because it's a good amount of work, partially because it will 
slow down the compiler considerably in some cases.


More information about the Digitalmars-d-learn mailing list