Skip Menu |
Report information
Id: 132794
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: pawel.pabian [at] getresponse.com
Cc:
AdminCc:

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



To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Date: Wed, 31 Jan 2018 15:25:33 +0000
Subject: Junction as default value of MAIN param hangs forever
From: Paweł Pabian <pawel.pabian [...] getresponse.com>
Download (untitled) / with headers
text/plain 209b
$ perl6 -e 'sub MAIN ( $x = 1|2 ) { }' Following oneliner will hang forever on Rakudo 2018.01. Error exists for all type of Junctions. Doesn't matter if they are built by infix "1|2" or by method "any(1,2)".
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 766b
On Wed, 31 Jan 2018 07:26:24 -0800, pawel.pabian@getresponse.com wrote: Show quoted text
> $ perl6 -e 'sub MAIN ( $x = 1|2 ) { }' > > Following oneliner will hang forever on Rakudo 2018.01. > Error exists for all type of Junctions. > Doesn't matter if they are built by infix "1|2" or by method "any(1,2)".
We can probably improve that behaviour with an error message (it applies to any routine, not just MAIN). The problem is you're declaring an Any parameter, but your default value is a Junction, so when the default is used, it's trying to autothread the Junction and I'm guessing it keeps looping there in the guts somewhere. Looking at your use, I'm suspecting you meant to use a `where` clause instead of the default value: `perl6 -e 'sub MAIN ( $x where 1|2 ) { }'
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.7k
On Wed, 31 Jan 2018 07:56:31 -0800, cpan@zoffix.com wrote: Show quoted text
> On Wed, 31 Jan 2018 07:26:24 -0800, pawel.pabian@getresponse.com > wrote:
> > $ perl6 -e 'sub MAIN ( $x = 1|2 ) { }' > > > > Following oneliner will hang forever on Rakudo 2018.01. > > Error exists for all type of Junctions. > > Doesn't matter if they are built by infix "1|2" or by method > > "any(1,2)".
> > We can probably improve that behaviour with an error message (it > applies to any routine, not just MAIN). > > The problem is you're declaring an Any parameter, but your default > value is a Junction, so when the default is used, it's trying to > autothread the Junction and I'm guessing it keeps looping there in the > guts somewhere. > > Looking at your use, I'm suspecting you meant to use a `where` clause > instead of the default value: > > `perl6 -e 'sub MAIN ( $x where 1|2 ) { }'
I started with this, but likely won't have time to finish it this week. In case someone else wants to give it a go, some notes: 1) jnthn++ agreed[^1] that this should throw 2) This code doesn't go through `check_param_default_type`[^2] in Actions. I tried passing the thunked[^3] defaults through the routine, but compilation fails with `Cannot unbox a type object (Str) to a str.` 3) The infiniloop is in the BOOTSTRAP[^4]. It basically keeps autothreading itself with no params over and over. [1] https://irclog.perlgeek.de/perl6/2018-01-31#i_15761475 [2] https://github.com/rakudo/rakudo/blob/72948e8477fdb92801a59a6e101b29c2da2f844e/src/Perl6/Actions.nqp#L5050-L5058 [3] https://github.com/rakudo/rakudo/blob/72948e8477fdb92801a59a6e101b29c2da2f844e/src/Perl6/Actions.nqp#L5061 [4] https://github.com/rakudo/rakudo/blob/72948e8477fdb92801a59a6e101b29c2da2f844e/src/Perl6/Metamodel/BOOTSTRAP.nqp#L3336-L3362


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