From: Brian Candler Date: 2010-08-01T20:20:12+09:00 Subject: Re: what is the correct way to extend native methods? Maurizio De Santis wrote: > why?? What ruby are you using? With ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] and your posted code, I get the following output: ["a", "ab"] "b" ert.rb:17:in `[]': can't convert Regexp into Integer (TypeError) from ert.rb:17 If I change it to alias_method :slice_without_regexp, :slice alias_method :slice, :slice_with_regexp alias_method :[], :slice_with_regexp then *that* gives a stack too deep error, but on the initial slice call. I'm afraid I don't know the solution though. I suspect slice is already an alias for [], or vice versa. -- Posted via http://www.ruby-forum.com/.