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

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

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



Subject: [REGRESSION] HyperWhatever can no longer be used to process a list ( (--**)(1,2,3,4,5) )
Download (untitled) / with headers
text/plain 652b
Code: say (--**)(1,2,3,4,5) Result (2015.12,2016.06): (0 1 2 3 4) Result (2016.11,HEAD): Cannot resolve caller prefix:<-->(Int); the following candidates match the type but require mutable arguments: (Mu:D $a is rw) (Int:D $a is rw) The following do not match for other reasons: (Bool $a is rw) (Mu:U $a is rw) (Num:D $a is rw) (Num:U $a is rw) (int $a is rw) (num $a is rw --> num) in block <unit> at /tmp/DOB7M3C38w line 1 While it is uncommon, I think the previous result is something one can sanely expect. Bisectable points to https://github.com/rakudo/rakudo/commit/de5d9e70cbfe678d2371d284e9384f53aba1eb94
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 2.6k
There are two parts to this: 1): I'd expect the new behaviour of HyperWhatever and wouldn't think it's a bug. You get the same with regular Whatever. <Zoffix> m: (--*)(1) <camelia> rakudo-moar 9fc616: OUTPUT«Cannot resolve caller prefix:<-->(Int); ... And in fact, I can argue the 2015.12 version had a bug in it: <Zoffix> committable6, 2015.12 my $x =1; say (--**)($x); say $x <committable6> Zoffix, ¦«2015.12»: (0)␤1 The `--` does not affect the value of $x (while on HEAD it does). I can see either behaviour useful. 2): HyperWhatever is just a glorified slurpy sub with `map`, so I played around with some code and found that the reason hyperwhatevers in the past did not affect $x is because slurpies "detached", or "debinded", or whatever you wanna call it, the given args and the contents of the slurpie had writable containers: <Zoffix> committable6, 2015.12 sub { --@_[0] }(1) <committable6> Zoffix, ¦«2015.12»: <Zoffix> m: sub { --@_[0] }(1) <camelia> rakudo-moar 9fc616: OUTPUT«Cannot resolve caller prefix:<-->(Int); ... On some level the above makes sense, however, that behavior changes depending on what *other* args get passed to the slurpie. For example, if we add an extra Int, it still cries about non-writable thing for prefix:<-->, but if the *extra* arg is, for example, an array, then the *first* argument suddenly receives a writable container for itself. <Zoffix> m: sub { --@_[0] }(1, 1) <camelia> rakudo-moar 9fc616: OUTPUT«Cannot resolve caller prefix:<-->(Int); ... <Zoffix> m: sub { --@_[0] }(1, [1]) <camelia> rakudo-moar 9fc616: ( no output ) I recall there was a brief discussion about the above but I've no idea what the outcome was. The fact that it's inconsistent with regard to whether or not an arg is writable, based on type of other args, can be a tricky source of bugs and IMO should be made consistent. Cheers, ZZ On Thu, 29 Dec 2016 08:55:08 -0800, alex.jakimenko@gmail.com wrote: Show quoted text
> Code: > say (--**)(1,2,3,4,5) > > > Result (2015.12,2016.06): > (0 1 2 3 4) > > > Result (2016.11,HEAD): > Cannot resolve caller prefix:<-->(Int); the following candidates > match the type but require mutable arguments: > (Mu:D $a is rw) > (Int:D $a is rw) > > The following do not match for other reasons: > (Bool $a is rw) > (Mu:U $a is rw) > (Num:D $a is rw) > (Num:U $a is rw) > (int $a is rw) > (num $a is rw --> num) > in block <unit> at /tmp/DOB7M3C38w line 1 > > > While it is uncommon, I think the previous result is something one can > sanely expect. > > Bisectable points to > https://github.com/rakudo/rakudo/commit/de5d9e70cbfe678d2371d284e9384f53aba1eb94
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 647b
This seems very related: <Zoffix_> m: sub foo (*@foo) { dd @foo[1] = 42 }; foo <foo bar>; foo |<foo bar>; <camelia> rakudo-moar 88140b: OUTPUT: «42␤Cannot modify an immutable Str␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤» It actually affects whether values in a created Map are mutable, *depending on how the Map was created*: <Zoffix_> m: dd Map.new(<foo bar>)<foo> = 42 <camelia> rakudo-moar 88140b: OUTPUT: «Int <element> = 42␤» <Zoffix_> m: dd Map.new(|<foo bar>)<foo> = 42 <camelia> rakudo-moar 88140b: OUTPUT: «Cannot modify an immutable Str␤ in block <unit> at <tmp> line 1␤␤»


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