On Sun, Jan 07, 2007 at 03:33:19AM -0800, Jonathan Lang wrote:
: IIRC, you don't even need .accepts for this. You could just say
:
: given $pattern {
:when $a ~~ $_ { ... }
:when $b ~~ $_ { ... }
:when $c ~~ $_ { ... }
: }
:
: ...since an explicit smart-match is a boolean expressio
Larry Wall wrote:
Lots of interesting ideas. But I don't think the reverse-test
situation will arise all that frequently. How 'bout we let the user
just say:
my macro statement_control: { "when .accepts: " }
or some such...
IIRC, you don't even need .accepts for this. You could just sa
Lots of interesting ideas. But I don't think the reverse-test
situation will arise all that frequently. How 'bout we let the user
just say:
my macro statement_control: { "when .accepts: " }
or some such...
Larry
On 1/5/07, Larry Wall <[EMAIL PROTECTED]> wrote:
Anyway, that gives us:
given $pattern {
when .accepts(42) {...}
}
I think this type of usage should be encouraged with a bit more
huffmanization. My first thought would be to add C to invert
the arguments to ~~ versus C.
given @
Larry Wall wrote:
Anyway, that gives us:
given $pattern {
when .accepts(42) {...}
}
which given typical usage patterns of switch statements is probably
adequately huffmanized, unless we want to go for something shorter
than accepts/rejects, like
acc/rej
pix/nix
ok/b
At the moment I'm leaning toward:
$pattern.accepts($thing)
$pattern.rejects($thing)
and going the other way
$thing ~~ $pattern
$thing.match($pattern)
$thing.subst($pattern)
and most generally, something like:
$thing.does($pattern)
$thing.when($pattern)
By the way,
On Fri, Jan 05, 2007 at 08:47:18PM +, Luke Palmer wrote:
: I propose that we remove the following two lines from the smart match
: table in S03:
:
:HashAny hash entry existence exists $_{$x}
:Array Any array contains item* any($_) === $x
:
: These are the two
--- Luke Palmer <[EMAIL PROTECTED]> wrote:
[extremely large *SNIP*]
> Maybe the "|"/"||" distinction isn't needed, and we just need a
> declarator on rules that says they are side-effect-free, and can thus
> be optimized.
[snip]
> I like this solution better than making a new operator. In Perl
>
> --- "Adam D. Lopresto" <[EMAIL PROTECTED]> wrote:
> > I propose that since the empty pattern is no longer legal (and
> > about time), we use "|" in patterns to indicate alternation without
> > preference, and "||" to indicate "try the first, then the second,
> > etc".
>
> Hmm
> A neat idea,
--- "Adam D. Lopresto" <[EMAIL PROTECTED]> wrote:
> I propose that since the empty pattern is no longer legal (and
> about time), we use "|" in patterns to indicate alternation without
> preference, and "||" to indicate "try the first, then the second,
> etc".
Hmm
A neat idea, but can you el
10 matches
Mail list logo