Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No-one really knows what happens when a &fail is called from within a regex #1524

Closed
p6rt opened this issue Feb 19, 2010 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 19, 2010

Migrated from rt.perl.org#72944 (status was 'rejected')

Searchable as RT72944$

@p6rt
Copy link
Author

p6rt commented Feb 19, 2010

From @masak

<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.

@p6rt
Copy link
Author

p6rt commented Jul 25, 2012

From @coke

This bug queue is for issues with the rakudo implementation, not the spec itself.

Moved the spec question to the spec queue at​:

Raku/old-design-docs#19

Thanks.
--
Will "Coke" Coleda

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jul 25, 2012

From @coke

This bug queue is for issues with the rakudo implementation, not the spec itself.

Moved the spec question to the spec queue at​:

Raku/old-design-docs#19

Thanks.
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 25, 2012

@coke - Status changed from 'new' to 'rejected'

@p6rt p6rt closed this as completed Jul 25, 2012
@p6rt p6rt added the spec label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant