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

Strange MOP type check cache error message when doing <at_pos(1)> in a regex in Rakudo #2637

Open
p6rt opened this issue Feb 3, 2012 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 3, 2012

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

Searchable as RT109734$

@p6rt
Copy link
Author

p6rt commented Feb 3, 2012

From @masak

<masak> how would you split a string into the first character and the
rest of the string in Perl 6?
<moritz> .split(/<at_pos(1)>/)
<jnthn> ooh
<moritz> nom​: say 'foobar'.split(/<at_pos(1)>/).perl
<p6eval> nom acbec8​: OUTPUT«No type check cache and no type_check
method in meta-object␤ in method reify [...]
<jnthn> How in the hell...
<moritz> jnthn​: indeed.
<moritz> I get the same output locally
* masak submits rakudobug
<jnthn> OK, what is at_pos doing... :)
<jnthn> Wild guess​: using nqp​::getattr somewhere it should be using
nqp​::getattr_i :)
<moritz> erm, is it even spelled at_pos?
<moritz> I might as well be misremembering something
<masak> at the very least, it's an LTA error message.
<p6eval> nom acbec8​: OUTPUT«=> <>␤ at => <>␤␤»
<moritz> star​: say 'foobar'.split(/<at(1)>/).perl
<p6eval> star 2012.01​: OUTPUT«("f", "oobar").list␤»
<masak> \o/
<moritz> ok, it helps to spell it correctly :-)
<jnthn> \o/
<masak> so, error is in using something that doesn't exist :)
<masak> typical "programmer never tried this path" thinko :)
<jnthn> nom​: say Any.^methods
<p6eval> nom acbec8​: OUTPUT«eager elems end classify uniq infinite
flat hash list pick roll reverse sort values keys kv pairs Array grep
first join map min max minmax postcircumfix​:<[ ]> at_pos all any one
none postcircumfix​:<{ }> reduce ACCEPTS␤»
<masak> oh!
<moritz> well, at_pos comes from Any
<jnthn> There's an at_pos in Any
<masak> right.
<masak> so it does something completely different.
<moritz> yes.
<masak> and the regex engine gets sad.
<jnthn> And doesn't return a cursor which...yes, that. :)
<masak> I will report this as best I can :P

So, at_pos returns something which the regex engine didn't expect, and
instead of failing gracefully, it fails disgracefully. Please fix.

@p6rt
Copy link
Author

p6rt commented Feb 11, 2016

From @skids

Checked on what the current behavior is​:

$ perl6 -e 'say "foobar".split(/<at_pos(1)>/).perl'
Method 'at_pos' not found for invocant of class 'Cursor'
  in block <unit> at -e line 1

...so for actually unknown methods the error message is fine. (AT-POS now)

However, the error for known but not cursor-returning methods is still LTA, though different​:

$ perl6 -e 'say "foobar".split(/<AT-POS(1)>/).perl'
P6opaque​: no such attribute '$!pos'
  in block <unit> at -e line 1

$ perl6 -e 'say "foobar".split(/<Bool>/).perl'
P6opaque​: no such attribute '$!pos'
  in block <unit> at -e line 1

$ perl6 -e 'say "foobar".split(/<pos>/).perl'
P6opaque​: no such attribute '$!pos'
  in block <unit> at -e line 1

$ perl6 -e 'say "foobar".split(/<prune>/).perl'
Cannot look up attributes in a type object
  in block <unit> at -e line 1

$ perl6 -e 'say "foobar".split(/<from>/).perl'
P6opaque​: no such attribute '$!pos'
  in block <unit> at -e line 1

$ perl6 -e 'say "foobar".split(/<target>/).perl'
P6opaque​: no such attribute '$!pos'
  in block <unit> at -e line 1

@p6rt
Copy link
Author

p6rt commented Feb 11, 2016

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

@p6rt p6rt added the Bug 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