Damian Conway skribis 2006-08-31 9:08 (+1000):
> return want.rw ?? $lvalue
> :: want.count == 2 ?? (7,11)
> :: want.item ?? 42
> :: want.list ?? 1..10
> ::die "Bad context;
s:g/::/!!/ # :)
Juerd
--
http://convolution.
Trey Harris asked:
This is eerily like Contextual::Return, which made me wonder if it's
even required in Perl 6.
Obviously we can do
return do given want {
when :($) { ... }
...
};
But "return do given want" flows so badly, I desperately want some sugar
Agent Zhang wrote:
>
> According to S04, given {} is at statement level, so you can't use it
> directly as an expression. But Perl 6 always allow you to say
>
> my $foo = do given {...}
>
> As well as
>
> my $foo = do if foo {...} else {...}
I confirmed this both work now with pugs!
I thin
In a message dated Tue, 29 Aug 2006, Mark Stosberg writes:
my $rm = sub { given $rm_param {
when Code { $rm_param(self) }
when Hash { %rm_param }
default{ self.query.param($rm_param) }
}}();
This is eerily like Contextual::Return, which made me wonder if it's eve
On 8/30/06, Mark Stosberg <[EMAIL PROTECTED]> wrote:
Sometimes I use 'given' blocks to set a value. To save repeating myself
on the right hand side of the given block, I found I kept want to do this:
my $foo = given { }
According to S04, given {} is at statement level, so you can't use it
di
Mark Stosberg wrote:
Sometimes I use 'given' blocks to set a value. To save repeating myself
on the right hand side of the given block, I found I kept want to do this:
my $foo = given { }
...and have whatever value that was returned from when {} or default {}
populate $foo.
Isn't it still th
Sometimes I use 'given' blocks to set a value. To save repeating myself
on the right hand side of the given block, I found I kept want to do this:
my $foo = given { }
...and have whatever value that was returned from when {} or default {}
populate $foo.
It turns out pugs already allow this, thr