Empty isn't passed as an arg. It's just an empty slip that gets flattened, so `orelse` ends up with a single block as the arg (the thunked "foo"), which gets returned.
I don't know whether it should be evaluated first. On Wed, 09 Nov 2016 15:52:35 -0800, lloyd.fo...@gmail.com wrote: > Thanks for the update. As viki hinted at, isn't this a bug in itself > (andthen problems aside). Why does Empty as the first arg to orelse return > a block? > > say (Empty orelse "foo") > > -> ;; $_ is raw { #`(Block|140421623865904) ... } > > Where as > > say (Any orelse "foo") > > returns the correct value. > > On Thu, Nov 10, 2016 at 1:51 AM Zoffix Znet via RT < > perl6-bugs-follo...@perl.org> wrote: > > > On Sun, 06 Nov 2016 20:25:50 -0800, lloyd.fo...@gmail.com wrote: > > > 15:18 < llfourn_> m: say (Str andthen .uc orelse "foo") # more golfed > > > 15:18 <+camelia> rakudo-moar 1c425f: OUTPUT«-> ;; $_ is raw { > > > #`(Block|81391040) ... }» > > > 15:23 < llfourn_> m: say (Str andthen .uc orelse "foo")("wee") > > > 15:23 <+camelia> rakudo-moar 1c425f: OUTPUT«foo» > > > > > > unless I totally missed what these are meant to do a Block is not what > > > should be returned from this expression. > > > > The issue is due to `andthen` (and `notandthen`) actually returning Empty > > instead of the advertized "first undefined value" and since Empty is a > > Slip, it causes an issue with `orelse`. > > > > While the fix is trivial, it causes fallout with `with` operator and right > > now we're waiting for TimToady to chime in on how things should be done. > > IRC conversation: > > https://irclog.perlgeek.de/perl6-dev/2016-11-09#i_13539174 > > > >