# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #74988]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=74988 >


<JimmyZ> rakudo: sub if() { '2' }; say if;
<p6eval> rakudo ab2322: OUTPUT«␤»
<masak> o.O
<JimmyZ> rakudo: sub if() { '2' }; say if();
<p6eval> rakudo ab2322: OUTPUT«2␤»
* masak submits rakudobug
<masak> std: sub if() { '2' }; say if;
<p6eval> std 30591: OUTPUT«Potential difficulties:␤  Unsupported use
of bare 'say'; in Perl 6 please use .say if you meant $_, or use an
explicit invocant or argument at /tmp/uedzAGDWOF line 1:␤------>
sub if() { '2' }; say⏏ if;␤ok 00:01 113m␤»
<masak> o.O
<masak> so... it's OK... but I shouldn't use a bare 'say'...
<masak> what?
<diakopter> backtracking?
<masak> diakopter: possibly.
<masak> diakopter: rakudo currently does something very similar, as
uncovered by JimmyZ++ earlier.
<TimToady> if is currently considered a terminator, as are all
statement modifiers
<TimToady> and terminators are slightly keywordish
<masak> why then is the statement not an error?
<masak> the 'if' needs to be followed by an expression if it's parsed
as a keyword, no?
<TimToady> you'd think
<masak> std: "OH HAI" if;
<p6eval> std 30591: OUTPUT«===SORRY!===␤Undeclared
routine:␤'if' used at line 1␤Check failed␤FAILED 00:01 110m␤»
<masak> case in point.
<TimToady> well, LTA error there
<masak> aye
<TimToady> but it shows characteristics of parsing something both as a
terminator and then as a term, which is a bit odd, so probably either
<TimToady> 1) some unnecessary backtracking, or
<TimToady> 2) something not properly hidden inside a "suppose"
<masak> this all goes into the ticket.
<TimToady> std: sub if() { '2' }; say if();
<p6eval> std 30591: OUTPUT«ok 00:01 111m␤»
<TimToady> and overriding the standard control words typically
requires parens on the call anyway, since the control words typically
steal the listop LTM slot
<TimToady> but anyone who writes "say if;" probably deserves a WTF
sort of error message anyway :)
<masak> yes, but not this:
<masak> rakudo: sub if() { '2' }; say if;
<p6eval> rakudo ab2322: OUTPUT«␤»

Reply via email to