Skip Menu |
Report information
Id: 130775
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: bartolin [at] gmx.de
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Mon, 13 Feb 2017 21:18:33 +0100
Subject: [JVM] Problems with 'with' and attached block
From: Christian Bartolomaeus <bartolin [...] gmx.de>
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 875b
The blockless form of 'with' works as expected on JVM, but there are some wrong results if there is a block attached to a 'with' condition: <bartolin> r: say 42 with Empty <camelia> rakudo-moar aac9ef, rakudo-jvm fb4f16: ( no output ) <bartolin> r: with Empty { say 42 } <camelia> rakudo-moar aac9ef: ( no output ) <camelia> ..rakudo-jvm fb4f16: OUTPUT«42␤» Same thing happens with Failure and an actual Failure: <bartolin> r: with Failure.new { say 42 } <camelia> rakudo-moar aac9ef: ( no output ) <camelia> ..rakudo-jvm fb4f16: OUTPUT«42␤» <bartolin> r: say 42 with Failure.new <camelia> rakudo-moar aac9ef, rakudo-jvm fb4f16: ( no output ) There are fudged tests in S04-statements/with.t for this problem and a newly added test in S03-smartmatch/any-num.t fails for the same reason. I'm going to add the number of this ticket to those tests.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 791b
I think I know what happens. On MoarVM we call the Perl 6 method 'defined': https://github.com/perl6/nqp/blob/ac9a66abad13a7fd3d52b22ba533a9f8436ad1ac/src/vm/moar/QAST/QASTOperationsMAST.nqp#L787 On JVM we test for concreteness (like nqp::isconcrete would do): https://github.com/perl6/nqp/blob/ac9a66abad13a7fd3d52b22ba533a9f8436ad1ac/src/vm/jvm/QAST/Compiler.nqp#L802 And then there are special versions of 'method defined' for Slip and Failure which are missed on JVM when testing for concreteness only: $ ./perl6-j -e 'say Empty.defined' False $ ./perl6-j -e 'use nqp; say nqp::isconcrete(Empty)' 1 $ ./perl6-j -e 'say Failure.new.defined' False $ ./perl6-j -e 'use nqp; say nqp::isconcrete(Failure.new)' 1 It looks like the implementation of 'with' needs some refinement on JVM.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org