On May 7, 2006, at 12:34 PM, Bob wrote:

> I was wondering if it's a good idea to use recursion sparingly in  
> Ruby?

My opinion is, yes, it is.

> How efficiently is it implemented?  Do recursive calls only store  
> local
> variables or the entire method?

I'm not aware of any recursive specific optimizations and method  
calls in general are fairly expensive in Ruby.

> Is there a maximum stack size/depth?

Yes and Ruby uses the C stack so it's fairly easy to hit.  I avoid  
recursion unless I am reasonably sure it will not go too deep.

James Edward Gray II