Re: RFC 110 (v3) counting matches
[email protected] (Chaim Frenkel)
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
What about a generator() keyword?[*] push @got, generator /bar/ Where generator keeps applying the EXPR or BLOCK until it runs out of results. [*] This resembles something that I must have read about in ICON. <chaim> >>>>> "TC" == Tom Christiansen <[email protected]> writes: TC> The reason why not is because you're adding a special case hack to TC> one particular place, rather than promoting a general mechanism TC> that can be everywhere. TC> Tell me: which is better and why. TC> 1) A regex switch to specify scalar context, as in a mythical /r: TC> push(@got, /bar/r) TC> 2) A general mechanism, say for example, "scalar": TC> push(@got, scalar /bar/) TC> Obviously the "scalar" is better, because it does not require that TC> a new switch be learnt, nor is its use restricted to pattern matching. TC> Furthermore, it's inarguably more mnemonic for the sense of "match this TC> scalarishly". -- Chaim Frenkel Nonlinear Knowledge, Inc. [email protected] +1-718-236-0183