Function literals and lambda functions
retard
re at tard.com.invalid
Sun Mar 6 15:27:28 PST 2011
Sun, 06 Mar 2011 20:24:12 +0000, Peter Alexander wrote:
> On 6/03/11 2:03 PM, Russel Winder wrote:
>> PS If you ask why not:
>>
>> reduce ! ( "a+b" ) ( 0.0 , outputData )
>>
>> I find this somehow unacceptable. It's the string, its not a function.
>> Fine, my problem, but that still leaves the above.
>
> You probably know this already, but just in case...
>
> The string is converted into a function at compile time, so if you were
> scared of the possible performance hit of having to parse the string at
> runtime, then you can rest assured that it is as fast as supplying a
> normal function.
>
> On the other hand, if you just don't like the appearance of a string as
> a function in source code then, yah, I agree. It does seem a little
> wrong, although you get used to it.
It also generates a bit of redundant code for each template instantiation.
No solution for this has been proposed afaik. It's a deal breaker in
embedded programming.
More information about the Digitalmars-d
mailing list