On Thu, 20 Nov 2003 20:57:58 +0900, Yukihiro Matsumoto wrote:
> In message "behaviour change of String#gsub(pattern) {|m| ... }
>| String#gsub(pattern) {|m| ... }
>|
>| It really would be nice to get match data in 'm', but this would
>| surely break _a lot_ of scripts. How about String#regsub,
>| #regsub!, #resub, #resub! ? What do others think?
> Sounds nice. The only reason for the current behavior is that sub
> predates MatchData. But we have to define migration path.

Is there an easy way for String#gsub (et al.) to check the arity of
the provided block?

  String#gsub(pattern) { |m, md| ... }
    yields match string and matchdata

  String#gsub(pattern) { |m| ... }
    yields match string only

That would break the least amount of code.

-austin
--
austin ziegler    * austin / halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.11.20
                                         * 10.18.43