Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

01_hello_world.pm6 fails to work as expected #1

Closed
zengargoyle opened this issue May 30, 2014 · 5 comments
Closed

01_hello_world.pm6 fails to work as expected #1

zengargoyle opened this issue May 30, 2014 · 5 comments

Comments

@zengargoyle
Copy link

When the "Hello World!" button is clicked it becomes inactive and the "Goodbye!" button becomes active. When the "Goodbye!" button is clicked. Exploring a bit deeper it appears that $second.clicked.tap() code is never executed, instead the $button.clicked.tap() code is run whenever either button is clicked.

diff --git a/examples/01_hello_world.pm6 b/examples/01_hello_world.pm6
index 8e9493a..548bc54 100644
--- a/examples/01_hello_world.pm6
+++ b/examples/01_hello_world.pm6
@@ -41,7 +41,7 @@ $app.border_width = 20;
 =comment
     Using the sensitive property we can make a button unclickable.

-$second.sensitive = False;
+#$second.sensitive = False;


 =begin comment
@@ -53,13 +53,13 @@ $second.sensitive = False;
     just C<.sensitive = 0>. The C<$second> button can then be activated.
 =end comment

-$button.clicked.tap({ .sensitive = False; $second.sensitive = True });
+$button.clicked.tap({ .sensitive = False; $second.sensitive = True; say "first button tap"; });


 =comment
     Clicking the second button shall C<exit> the application's main loop.

-$second.clicked.tap({ $app.exit; });
+$second.clicked.tap({ say "second button tap"; $app.exit; });


 =comment

With these changes, the "Goodbye!" button is active, yet when clicked I see 'first button tap' output and "Hello World!" button disabled.

I've tried with JVM/Moar backends on Rakudo Star 2014.04 and Rakudo (not Star) 2014.05 with the same results.

I assume this example worked at some point in the past. Sadly my Perl6 skills are not yet sufficient to dig much further.

@raiph
Copy link

raiph commented May 30, 2014

http://irclog.perlgeek.de/perl6/2014-05-22#i_8761466 might be relevant. I recall some work on this since but a quick search didn't show it. Have you visited #perl6? timotimo is on their often.

@timo
Copy link
Contributor

timo commented May 30, 2014

Hello,

indeed, the discussion raiph linked to is very closely related to this bug; After jnthn explained to me what exactly happened, I was able to fix it in MoarVM. If you used --gen-moar to build your MoarVM, you may not have a sufficiently new MoarVM; if you --gen-moar=master, it should work.

MoarVM/MoarVM/c511cb7 is the commit where the problem gets fixed. MoarVM's NativeCall implementation used to treat every Code Object with the same CUID (compilation unit ID, a compile-time created identifier) as the same object. The clicked method of the Button generates two different closures (one for each button instance), but only one is ever called back from Gtk when a click happens.

Since you said the bug still persists on the JVM backend, I'll leave this bug open until that is sorted. It likely needs about the same fix.

@vendethiel
Copy link
Contributor

@timo you can use the syntax " MoarVM/MoarVM@c511cb7 " to link to a commit in a separate repo :)

@azawawi
Copy link
Contributor

azawawi commented May 27, 2016

Is this still an issue with the latest?

@azawawi azawawi added the bug label May 27, 2016
finanalyst added a commit that referenced this issue Dec 25, 2016
@ghost
Copy link

ghost commented Sep 1, 2018

Is this still a bug? I'll close this for now.

@ghost ghost closed this as completed Sep 1, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants