I'll never refuse a free beer. ;-)
On the example code, there are two other things to keep in mind:
1) Have to save away the value of arguments.callee before going into the
inner function (arguments is always bound to the innermost function);
2) If you want to actually call the function recursively *as a method of
this*, the above syntax won't work. You'll need to do something like:
MyNS.Package.prototype.myRecursiveFunction =
function(SomeComplexDataStructure) {
* var outer_fn = arguments.callee;
var outer_this = this;
*
SomeComplexDataStructure.DataPart.each( function(DataPart) {
* outer_fn.call(outer_this, DataPart);* // or whatever the args should
be
} );
}
On Mon, May 26, 2008 at 2:48 PM, Jonathan Logue <[EMAIL PROTECTED]>
wrote:
>
> Thanks so much! I kept reading about how the inner function had access
> to the members of the outer function but could not find an example of
> calling the actual function. You are a life saver.
>
> I'll buy you a beer if I am ever in Chicago!
>
> -Jonathan
--
Science answers questions; philosophy questions answers.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---