On 08/12/05 17:12, Larry Wall wrote: > On Thu, Dec 08, 2005 at 11:14:16PM +0100, Brad Bowman wrote: > : it may be acceptable with a "my" in the regex or limiting the > : additions to declaring scope. > > I've gone around about that in my head lots of time, but there isn't > a good way to sneak a "my" into rule syntax, and besides, we're trying > to encourage people to think of rules as lexical scopes in their own > right, so even if you did sneak a "my" in there somehow, it would > most naturally limit itself to the scope of the rule.
Perhaps the "my" could then be placed outside the rule but apply to the variables bound in the rule. Then the scoping would seem natural and would have to be explicitly asked for. I'm not sure where it could be squeezed in: $str ~~ my m/ mv @files:=<ident>+ $dir:=<ident> / Nah, that's ugly. I considered a :my modifier but if you use a rule from elsewhere that was created with rx:my/../ then variables pop into existence. Perhaps :my can only be used with m// at rule applications. But then matching is run time and my is compile time... > And, of course, part of our reason for the $<foo> shortcut notation > is to take some of the pressure off the desire for lexical leakage, That does do ease the pressure. I'm sure I'll be able to cope. :) > Anyway, @Larry is also trying to come at it from the other direction > by allowing signatures as part of rule syntax, but that's motivated > by wanting to do pattern matching on trees, where a list of child > nodes is construed to look like an argument list. In theory a > declarative nested parameter syntax can be reversed and used to write > the constructors to rebuild the tree that would also be parseable by > the syntax. (Or at least one of those trees.) Great! I'll never need to learn XPATH or XSLT and my YAML schemas will be rules. Presuming I'm understanding correctly. One aspect of the "Matching against non-strings" of S05 that seemed a little strange is the string, string tie-able or array limitation. Couldn't there be a Matchable role that trees or other objects can do? While I'm on the topic, how do you bump to the next object when matching against tokens or other objects in an array? I guess I'm asking is <.does('Bark')> a zero-width assertion? Or does <,> skip to the boundary? (presumably not) Brad -- People with intelligence will use it to fashion both true and false and will try to push through whatever they want with their clever reasoning. This is injury from intelligence. Nothing you do will have effect if you do not use truth. -- Hagakure