> > So, we create LastMatch, and get rid of Backref and NthRef operands and > > convert them into special calls on the LastMatch operand. > > > > And, here are the two significant changes. If there are no uses of > > LastMatch in a method (and all descendent scopes -- blocks passed into > > calls), then there is no reason for RubyString/RubyRegexp to do anything > > with updateBackref. This also means that scopes can have reg-exp calls > and > > can still get by without allocating a heap binding for those scopes. The > > question is how to pass this information into RubyString/RubyRegexp. > One is > > by way of a special flag set somewhere on the call stack ... or by using > > special-purpose calls in Regexp. The existing AST implementations might > > also be able to take advantage of it, I think ... > > I don't see here how two methods -- one that writes backref and one > that reads it -- would be satisfied. Not all uses of $~ (for example) > read $~ in the body of the Ruby code; it's possible to use it across > calls without ever using any of the specially-named globals. >
I was making my case on the assumption that access to $~ is always through Ruby code, and that if there is no reference to it in Ruby code, it is not needed. So I can think about this more concretely, can you give me example Ruby code where this is the case (use of $~ outside Ruby code itself)? Subbu.