Re: RFC 110 (v3) counting matches
[email protected] (Nathan Wiger)
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Organization | Sun Microsystems |
| Message-ID | <[email protected]> |
Jonathan Scott Duff wrote: > > I'll agree that /l is bad too. But I think adding a new "list" > keyword is also bad. What about other contexts? Are we going to have > "scalar", "list", "hash", "boolean", "string", "number", etc.? Not to > mention (even though I am) user-defined contexts (my Dog $spot; $spot > = gen_dog(); <-- that's a "Dog" context). The interesting thing is that "scalar" and "list" are the only two that can't be done completely implicitly without arbitrary edge case decisions. Nobody wants to admit this, but it's true. Somebody once posted a "proof" of this, but I'll have to dig... And hashes are assembled just like lists anyways: %hash = list get_key_vals; %hash = (key, val, key2, val2); # same thing But no, I certainly wouldn't suggest going down the path of 1000 explicit contexts. Bad. Implicit context good! But a "list" helper function like a "scalar" helper function would solve a lot of common problems. Not Perl 5? Probably. Not Perl 6? Don't buy it. Bad idea? Maybe. -Nate