From: Mathieu Bouchard Date: 2002-01-21T03:06:15+09:00 Subject: Re: $_ as default parameter for a function On Sun, 20 Jan 2002, Thomas wrote: > Mathieu Bouchard wrote in message > > set_trace_func(proc{|*a| > > w.puts(eval("$_", a[4]).inspect) > I'd expect a significant performance penalty for the code above. Any > ideas about how expensive the code above is? Most of the performance penalty should be in the call to fork(), even on fast-forking kernels like Linux. Anyway, I didn't write that code to see it used, but rather to tell that either using $_ is wrong, or Ruby lacks a feature or two. See also RCR #29: http://www.rubygarden.org/article.php?sid=89 in that case you would be able to look it up like eval("$_",binding.caller), which would be quite fast. ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju