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, [email protected] wrote:
> 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