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

temp on an undeclared dynamic variable produces a not very helpful error #6497

Closed
p6rt opened this issue Sep 5, 2017 · 5 comments
Closed
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Sep 5, 2017

Migrated from rt.perl.org#132035 (status was 'resolved')

Searchable as RT132035$

@p6rt
Copy link
Author

p6rt commented Sep 5, 2017

From @geekosaur

Seen in IRC​:

[05 17​:51​:12] <Zoffix> m​: grammar { token TOP { :my $*v = 42; <foo> };
token foo { {dd $*v } &lt;bar&gt; }; token bar { :temp $*val = 100; <bez> };
token bez { {dd $*val } .+ } }.parse​: "foo"
[05 17​:51​:12] <camelia> rakudo-moar c39db8​: OUTPUT​: «Int $*v = 42␤
[05 17​:51​:12] Can only use 'temp' on a container␤
[05 17​:51​:12] in regex bar at <tmp> line 1␤
[05 17​:51​:12] in regex foo at <tmp> line 1␤
[05 17​:51​:12] in regex TOP at <tmp> line 1␤
[05 17​:51​:12] in block <unit> at <tmp> line 1␤
[05 17​:51​:12] ␤
[05 17​:51​:12] »
[05 17​:51​:20] <Zoffix> ... and I'm using it on... ?
[05 17​:51​:45] <Zoffix> piojo2​: well, that would've been ^ a better
solution, but apparently that's also broken :P
[05 17​:52​:00] <Zoffix> Oh, wait
[05 17​:52​:16] <Zoffix> m​: grammar { token TOP { :my $*v = 42; <foo> };
token foo { {dd $*v } &lt;bar&gt; }; token bar { :temp $*v = 100; <bez> }; token
bez { {dd $*v } .+ } }.parse​: "foo"
[05 17​:52​:16] <camelia> rakudo-moar c39db8​: OUTPUT​: «Int $*v = 42␤
[05 17​:52​:16] Int $*v = 100␤
[05 17​:52​:16] »
[05 17​:52​:24] <Zoffix> It works if you name your variables right :P
[05 17​:53​:39] <geekosaur> that error seems a trifle LTA

Apparently it's reacting to the default value being a Failure. Which is
fine as to mechanism, but it'd be better for it to note an uninitialized
variable and still better yet to recognize that it could be a typo.

(Yes, I recognize this could be tricky.)

--
brandon s allbery kf8nh sine nomine associates
allbery.b@​gmail.com ballbery@​sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

@p6rt
Copy link
Author

p6rt commented Sep 5, 2017

From @geekosaur

Or maybe it's not that tricky after all; seems the Failure is actually a
useful one (X​::Dynamic​:NotFound), so introspection of the Failure would
reveal the issue.

--
brandon s allbery kf8nh sine nomine associates
allbery.b@​gmail.com ballbery@​sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

@p6rt
Copy link
Author

p6rt commented Sep 6, 2017

From @jnthn

On Tue, 05 Sep 2017 11​:02​:59 -0700, allbery.b@​gmail.com wrote​:

Or maybe it's not that tricky after all; seems the Failure is actually a
useful one (X​::Dynamic​:NotFound), so introspection of the Failure would
reveal the issue.

Indeed. I added code to check if the thing we were trying to temporize was a Failure and just throw that instead of the more generic error, which improves the error reporting and has no ill effects on the spectest. Also added a test in S04-blocks-and-statements/temp.t to cover the improvement.

@p6rt
Copy link
Author

p6rt commented Sep 6, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 6, 2017

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 6, 2017
@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant