This is covered in:
https://rt.perl.org/Public/Bug/Display.html?id=128156
On Tue, Jun 7, 2016 at 6:24 AM Tobias Leich
wrote:
> # New Ticket Created by Tobias Leich
> # Please include the string: [perl #128332]
> # in the subject line of all future correspondence about this issue.
> # https://
Here's another example from gtk-simple:
https://github.com/perl6/gtk-simple/blob/d1fcc6efe1da3fd88a26b4328d6537c58607dee7/examples/07-text.pl6
Written with cascade:
https://gist.github.com/dharmatech/b8e8a71da8149382f192603e1b92d9b8
Ed
On Mon, Jun 6, 2016 at 4:12 PM, Eduardo Cavazos
wrote:
>
On Mon, Jun 6, 2016 at 5:47 PM, yary wrote:
> GTK::Simple::Button.new(label => 'bcd').clicked. ...
whoops, that should be
with GTK::Simple::Button.new(label => 'bcd') {
.clicked.tap({ .sensitive = False; $button.sensitive =
True; });
}
alas I am on win
That's a nice & small answer. It does seem overkill for the gtk example...
use v6;
use GTK::Simple;
with GTK::Simple::App.new(title => 'abc') {
my $app = $_;
my $button;
.set-content:
GTK::Simple::VBox.new(
GTK::Simple::Button.new(label => 'bcd').clicked.tap({
Looks like I can get pretty close to what I was looking for with this
subroutine:
sub cascade ($obj, &proc) { proc($obj); $obj; }
Then, given the Point class again:
class Point { has $.x is rw; has $.y is rw; }
this:
(Point.new.&cascade: {.x = 10;}; Point.new.&cascade: {.y = 20;})
# New Ticket Created by Tobias Leich
# Please include the string: [perl #128332]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=128332 >
I've got the following files:
~/dev/rakudo/test$ tree .
.
├── A.pm
├── B.pm
└── C.pm
$
On Mon, Jun 6, 2016 at 3:47 PM, Brandon Allbery wrote:
> But for that there is "given". I thought the whole point of "with" vs.
> "given" was the definedness check.
Ah yes, and that's a great feature. I forgot that "with" skips over
the block when the topic is undefined, and that is very useful.
On Mon, Jun 6, 2016 at 3:45 PM, yary wrote:
> On Mon, Jun 6, 2016 at 3:27 PM, Elizabeth Mattijsen
> wrote:
> > “with” is completely agnostic about what it is working on. It merely
> checks for definedness and sets the topicalizer if so.
>
> Hmm- what's the benefit of with's defined check? Seem
On Mon, Jun 6, 2016 at 3:27 PM, Elizabeth Mattijsen wrote:
> “with” is completely agnostic about what it is working on. It merely checks
> for definedness and sets the topicalizer if so.
Hmm- what's the benefit of with's defined check? Seems like it makes
"with" break if used with type objects
> On 06 Jun 2016, at 21:17, Eduardo Cavazos wrote:
>
> On Mon, Jun 6, 2016 at 2:08 PM, yary wrote:
>
> For your particular case, would it be sufficient to set the values in
> the constructor?
>
> with Point.new( :x(10) ) { .say }
> # says "Point.new(x => 10, y => Any)"
>
> Normally, that w
On Mon, Jun 6, 2016 at 2:12 PM, Eduardo Cavazos wrote:
>
> with_alt Point.new { .x = 10; }
>
> would return a Point.
>
> And this:
>
> (with_alt Point.new {.x = 10}; with_alt Point.new {.y = 20})
For your particular case, would it be sufficient to set the values in
the constructor?
with
On Mon, Jun 6, 2016 at 2:08 PM, yary wrote:
>
> For your particular case, would it be sufficient to set the values in
> the constructor?
>
> with Point.new( :x(10) ) { .say }
> # says "Point.new(x => 10, y => Any)"
>
Normally, that would be a good way to construct the Points in my example.
I'm
Hello,
Here's a simple class:
class Point { has $.x is rw; has $.y is rw; }
'with' seems to return the result of evaluating the block. E.g. this
expression will return a Point:
with Point.new { .x = 10; $_; }
Whereas this will return 10:
with Point.new { .x = 10; }
Is there a way
# New Ticket Created by Lloyd Fournier
# Please include the string: [perl #128330]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=128330 >
Delegating array behaviour to an attribute is a common pattern.
class Foo {
has @
# New Ticket Created by Mathieu Gagnon
# Please include the string: [perl #128324]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=128324 >
Hello,
$ perl6 --version
This is Rakudo version 2016.04 built on MoarVM vers
On Sun, 5 Jun 2016, Elizabeth Mattijsen via RT wrote:
On 05 Jun 2016, at 09:52, Wenzel Peppmeyer (via RT)
wrote:
# New Ticket Created by Wenzel Peppmeyer
# Please include the string: [perl #128321]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org
# New Ticket Created by "Hinrik Örn Sigurðsson"
# Please include the string: [perl #128326]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=128326 >
class Foo { has $.bar; method CALL-ME ($b) { self.new(bar => $b) } }; say
Foo
17 matches
Mail list logo