> -----Original Message----- > From: Damian Conway [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 10 March, 2004 09:48 PM > To: [EMAIL PROTECTED] > Subject: Re: Mutating methods > > > Brent "Dax" Royal-Gordon wrote: > > >> / $foo:=(abc) $bar:=(def) / > > > > Am I misreading, or are you suggesting that $foo may contain > 'abc' after > > running this example, even if the match wasn't successful? > > No. I re-checked with Larry this morning and he confirmed that > all bindings in > rules only "stick" if the rule as a whole succeeds. > > What I was trying (obviously rather ineptly ;-) to point out is > that we have > to be able to differentiate between the the match object's own internal > hypothetical variables ($?foo, $?bar, @?baz) and any > external-but-temporarily-hypothesized variables ($foo, $bar, @baz). > > The syntax we've chosen to do that requires the use of "?" as a secondary > sigil on internal variables. So, since named subrules that capture always > capture to internal variables, it's natural and consistent to use "?" to > indicate capturing subrules as well.
Isn't this backwards? That is, from the above I get the impression that $?foo is TRANSIENT, while capturing to $foo will (eventually) be PERMANENT. So <?foo> is just a shorthand way of saying $?foo := <foo> right? Is hypo-space a flat entity, or do hypothetical scopes nest? If so, do we have to use repeated ?'s, or will just one suffice? That is: rule bar {...} rule baz {...} rule foo {...bar...baz...} if / <?foo> ... <?baz> ... { $?foo.?baz ... $?baz } .../ OR if / <?foo> ... <?baz> ... { $?foo.baz ... $?baz } .../ OR if / <?foo> ... <?baz> ... { $?baz ... $?otherbaz } .../ =Austin