At 10:41 AM -0600 3/19/03, Jonathan Scott Duff wrote:
On Wed, Mar 19, 2003 at 11:09:01AM -0500, Dan Sugalski wrote:
 By the time the regex is actually executed, it's fully specified. By
 definition if nothing else--you aren't allowed to selectively
 redefine rules in the middle of a regex that uses those rules. Or,
 rather, you can but the update won't take effect until after the end
 of the regex, the same way that you can't redefine a sub you're in
 the middle of executing. (And yes, I'm aware that if you do that
 you'll pick up the new version if you recursively call, but that
 won't work with regexes)

Are you implying that


        $fred = rx/fred/;
        $string ~~ m:w/ <$fred> { $fred = rx/barney/; } rubble /

won't match "barney rubble"?

Potentially, no. What, then, should happen if you do:


   $barney = rx/barney/;
   $string = "barney rubble";
   $string ~~ m:w/ <$barney> { $barney = rx/fred/; } rubble /;

The regex shouldn't match, since you've invalidated part of the match in the middle.

I can potentially see constructs of the form <$var> be taken as indirect rule invocations and their dispatch left to runtime, complete with the potential for bizarre after-the-fact invalidations, but as regex rules in the regex stream rather than as generic code.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to