On Sun, 30 Apr 2017 17:11:08 -0700, c...@zoffix.com wrote: > I expected these two forms to behave the same: > > <Zoffix_> m: my $ where .so && .name = sub foo {} > <camelia> rakudo-moar a2602b: OUTPUT: «Sub object coerced to string > (please use .gist or .perl to do that) in block <unit> at <tmp> line > 1» > <Zoffix_> m: my $ where { .so && .name } = sub foo {} > <camelia> rakudo-moar a2602b: ( no output ) > > However, it looks like in the thunk form, the return value of the > thunk is then smart matched against the original value.
Well, I fixed this bug!.... and then realized it's not even a bug. The behaviour without the block is correct: when checking, the thunk calls .so and then .name, and the return value of that gets smartmatched agains. This is the same as what we do with `when` clauses. The correct way to write that would be to use `&`.