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


<pausenclown> rakudo: "123" ~~ /  <[ a..z ]> { fail "ugh" } /; say $!
<p6eval> rakudo 3704a2: OUTPUT«Mu()␤»
<pausenclown> mmh
<masak> pausenclown: that's a bug, you figure?
<masak> pausenclown: want to submit it to RT?
<pmichaud> ...why is that a bug?
<pausenclown> i don't know it's a bug or not.
<masak> pausenclown: the pmichaud reply seems to imply it's not :)
<masak> so, where *would* the 'ugh' end up?
<pmichaud> we never reach the 'ugh'
<masak> oh!
<masak> of course. :P
<pausenclown> rakudo: "123" ~~ /  [ <[ a..z ]> || { fail "ugh" } ] /; say $!
<p6eval> rakudo 3704a2: OUTPUT«Mu()␤»
<pmichaud> okay, that's more of a bug :)
<masak> pausenclown: shall you or I submit it?
<pmichaud> ooc, what *should* happen there?
<pausenclown> I'm just toying around
<masak> pausenclown++
<masak> pausenclown: still. it's a new discovery.
<pmichaud> does fail set $! ?
<masak> not that I know.
<pausenclown> The Exexgesis says it should.
<pmichaud> heh
<pmichaud> Exegesis tend to be waaaaay out of date.
<masak> indeed.
<pausenclown> That they tell me now
<masak> pmichaud: where, according to you, would the 'ugh' end up?
<pmichaud> masak: I have no idea, actually, thus my question :)
<moritz_> I've asked TimToady where parsing error message (like from
fail or from ~ ) end up
<moritz_> and so far I haven't got an understandable answer
<pausenclown> rakudo: "123" ~~ /  [ <[ a..z ]> || { fail "ugh" } ] /; say $/
<p6eval> rakudo 3704a2:  ( no output )
<jnthn> fail is like a return.
<jnthn> afaik
<pmichaud> what jnthn++ said.
<pmichaud> fail returns an object that throws an exception when it's used.
<jnthn> Given we're only in a closure, it probably causes us to fall
out of the entire regex.
* masak considers all the ambient confusion a bug and submits that
<pmichaud> actually, I think we might fall out of the surrounding sub.
<jnthn> Well, other question: is an anonymous regex and a named regex different?
<pmichaud> because a regex is more like a block than a sub in this case.
<jnthn> Yeah
<jnthn> Probably fall from surrounding sub here.
<pmichaud> that might be the case... but I'm not certain of that either.  :)
<jnthn> Whether if that'd been a regex { ... } though...
<pausenclown> "The call to fail causes the match to fail at that
point, and sets an associated error message that would subsequently
appear in the $! error variable (and which would also be accessible as
part of $0)."
<pausenclown> http://dev.perl.org/perl6/doc/design/exe/E05.html
<jnthn> Oh
<jnthn> It begins with an E
<pmichaud> E05 also says...
<jnthn> ...a lot of other out of date stuff.
<jnthn> ;-)
<pmichaud> [Update: Please note that this was written several years ago, and
<pmichaud> a number of things have changed since then.  Rather than changing
<pmichaud> the original document, we'll be inserting "Update" notes like this
<pmichaud> one to tell you where the design has since evolved.  (For the better,
<pmichaud> we hope).  In any event, for the latest Perl 6 design (or
to figure out
<pmichaud> any cryptic remarks below) you should read the Synopses,
which are kept
<pmichaud> very much more up-to-date than either the Apocalypses or Exegeses.]

Consider this ticket closable when the questions "Where does the 'ugh'
end up?" and "Is the behavior of &fail inside an anonymous regex
different from the behavior of &fail inside a named regex?" have been
answered.

Reply via email to