On 07/18/12 01:05, Kevin Cox wrote:
> 
> On Jul 17, 2012 6:50 PM, "Era Scarecrow" <[email protected] 
> <mailto:[email protected]>> wrote:
>>
>> On Tuesday, 17 July 2012 at 22:13:13 UTC, Eyyub wrote:
>>>
>>> On Tuesday, 17 July 2012 at 16:56:17 UTC, angel wrote:
>>>>
>>>> I propose to introduce a reference to the current function, much like 
>>>> 'this' in a class method. Call it 'self' or 'thisFunc', or whatever ...
>>>> What might this be good for ?
>>>> For implementing recursion in a lambda function. Writing in functional 
>>>> style, one creates many functions, and looking for reasonable names for 
>>>> these functions becomes unnecessarily painful.
>>>
>>>
>>> Good idea !
>>> "self" is a cute keyword, or "lambda" but this could break existing code.
>>
>>
>> Mmm.. Why not an inner function to represent the recursive function? True a 
>> 'self' reference may resolve the issue,
> 
> What about how JavaScript does it.  Anonymous functions can still have a 
> "name" that can be used from inside of a function to refer to itself.
> 
> And the most useless example ever.
> 
> var f = function func ( i ) {
>     return func(7);
> };
> 
> I think that this is nice because there is no name space pollution, no new 
> keywords needed and it is pretty.
> 
Sadly, this collides with the return-type syntax already in place.

auto f = function int(int i) { return 0; };

Reply via email to