in reply to Re: Re: Re: Re: Re: Re: Recursion Alternatives?
in thread Recursion Alternatives?
However I think the elegance of the Pascal approach, as well as the encapsulation it provides is quite nice.
I missed nested functions when I switched from Pascal to C. (Gawd... that was 15 years ago. I feel so old.) That kind of procedural encapsulation seems to be out of style, though. Nowadays, if you want to keep people from calling your functions, you just make them private methods.
The point was that this reference doen't need to be placed on the stack. It can be resolved once and then never again.
I'm not sure I follow you here. Are you thinking that each instance of a closure gets a clone of the optree with the reference inserted in the right place? That doesn't seem to be the case, if I'm reading the Devel::Peek output right. It wouldn't be very efficient for large closures, either.
|
|---|