Re: [perl #131239] where clause thunk's return value used for smartmatching
If Zoffix gets this confused, maybe the explanation needs some work for mere mortals? On 4/30/17, Zoffix Znet via RTwrote: > On Sun, 30 Apr 2017 18:47:16 -0700, c...@zoffix.com wrote: > >> The correct way to write that would be to use `&`. > > And .so on .name >
[perl #131239] where clause thunk's return value used for smartmatching
On Mon, 01 May 2017 10:15:03 -0700, 1parr...@gmail.com wrote: > If Zoffix gets this confused, maybe the explanation needs some work > for mere mortals? Added a note to docs in https://github.com/perl6/doc/commit/80165120fe
[perl #131239] where clause thunk's return value used for smartmatching
On Mon, 01 May 2017 10:15:03 -0700, 1parr...@gmail.com wrote: > If Zoffix gets this confused, maybe the explanation needs some work > for mere mortals? Added a note to docs in https://github.com/perl6/doc/commit/80165120fe
Re: [perl #131239] where clause thunk's return value used for smartmatching
If Zoffix gets this confused, maybe the explanation needs some work for mere mortals? On 4/30/17, Zoffix Znet via RTwrote: > On Sun, 30 Apr 2017 18:47:16 -0700, c...@zoffix.com wrote: > >> The correct way to write that would be to use `&`. > > And .so on .name >
[perl #131239] where clause thunk's return value used for smartmatching
On Sun, 30 Apr 2017 18:47:16 -0700, c...@zoffix.com wrote: > The correct way to write that would be to use `&`. And .so on .name
[perl #131239] where clause thunk's return value used for smartmatching
On Sun, 30 Apr 2017 18:47:16 -0700, c...@zoffix.com wrote: > The correct way to write that would be to use `&`. And .so on .name
[perl #131239] where clause thunk's return value used for smartmatching
On Sun, 30 Apr 2017 17:11:08 -0700, c...@zoffix.com wrote: > I expected these two forms to behave the same: > > m: my $ where .so && .name = sub foo {} > rakudo-moar a2602b: OUTPUT: «Sub object coerced to string > (please use .gist or .perl to do that) in block at line > 1» > m: my $ where { .so && .name } = sub foo {} > 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 `&`.
[perl #131239] where clause thunk's return value used for smartmatching
On Sun, 30 Apr 2017 17:11:08 -0700, c...@zoffix.com wrote: > I expected these two forms to behave the same: > > m: my $ where .so && .name = sub foo {} > rakudo-moar a2602b: OUTPUT: «Sub object coerced to string > (please use .gist or .perl to do that) in block at line > 1» > m: my $ where { .so && .name } = sub foo {} > 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 `&`.
[perl #131239] where clause thunk's return value used for smartmatching
# New Ticket Created by Zoffix Znet # Please include the string: [perl #131239] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=131239 > I expected these two forms to behave the same: m: my $ where .so && .name = sub foo {} rakudo-moar a2602b: OUTPUT: «Sub object coerced to string (please use .gist or .perl to do that) in block at line 1» m: my $ where { .so && .name } = sub foo {} 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.