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

Stupidly using is assoc with unary prefix operator has an error message from the deep #6662

Open
p6rt opened this issue Jan 12, 2018 · 4 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Jan 12, 2018

Migrated from rt.perl.org#132711 (status was 'open')

Searchable as RT132711$

@p6rt
Copy link
Author

p6rt commented Jan 12, 2018

From @briandfoy

I stupidly did this​:

  sub prefix​:<²> ( Int​:D \m --> Int​:D )
  is assoc<right>
  { m ** m }

  put ²(²2);

And got this error​:

  ===SORRY!===
  MVMArray​: Can't pop from an empty array

I figure that associativity doesn't make any sense for unary prefix
operators but that error message is from pretty deep in the swamp. I'd
rather have something like "Don't do stupid things that make no sense"
sort of error.

@p6rt
Copy link
Author

p6rt commented Jan 12, 2018

From @zoffixznet

On Thu, 11 Jan 2018 23​:40​:54 -0800, comdog wrote​:

I stupidly did this​:

sub prefix&#8203;:\<²>  \( Int&#8203;:D \\m \-\-> Int&#8203;:D \)
    is assoc\<right>
    \{ m \*\* m \}

put ²\(²2\);

And got this error​:

===SORRY\!===
MVMArray&#8203;: Can't pop from an empty array

I figure that associativity doesn't make any sense for unary prefix
operators but that error message is from pretty deep in the swamp. I'd
rather have something like "Don't do stupid things that make no sense"
sort of error.

This looks to be the same issue as #6173. It lists a potential fix that fails compilation​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131099#txn-1455809

@p6rt
Copy link
Author

p6rt commented Jan 12, 2018

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

@p6rt
Copy link
Author

p6rt commented Jan 14, 2018

From @zoffixznet

On Fri, 12 Jan 2018 03​:50​:19 -0800, cpan@​zoffix.com wrote​:

This looks to be the same issue as RT#​131099. It lists a potential fix
that fails compilation​:
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131099#txn-1455809

The fix is to throw on attempt to use list assoc on non-infixes, but
there're explosions with many other assocs; looks like anything that isn't unary. And
we can't throw on those, because assoc is meant to be used to disambiguate between
prefix/postfix that have same precedence.

It explodes in EXPR parser when trying to pop from @​termstack. That area is too hard
for me right now, so I'm giving up on this ticket, in case anyone else wants to give a go...

@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