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

can't get list of methods on a Sub #2968

Closed
p6rt opened this issue Nov 9, 2012 · 4 comments
Closed

can't get list of methods on a Sub #2968

p6rt opened this issue Nov 9, 2012 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Nov 9, 2012

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

Searchable as RT115658$

@p6rt
Copy link
Author

p6rt commented Nov 9, 2012

From @rjbs

I like that I can easily get a list of methods on a value​:

  > my $x = []; say $x.^methods
  new bind_pos delete flattens REIFY STORE_AT_POS STORE PARAMETERIZE_TYPE
  at_pos perl new Bool Int end fmt flat list lol flattens tree Capture Parcel
  eager elems exists gimme infinite iterator munch pick pop roll reverse
  rotate shift splice sort classify categorize uniq REIFY STORE_AT_POS
  FLATTENABLE_LIST FLATTENABLE_HASH keys values pairs kv reduce of Numeric
  Str at_pos push unshift ACCEPTS gist perl DUMP elems infinite item fmt Int
  Num chrs Numeric Str

It doesn't work on a Sub.

  > my $x = sub {}; say $x.^methods
  Method 'gist' not found for invocant of class 'Sub'

  my $x = sub {}; say $x.^methods.flat
  Method 'Stringy' not found for invocant of class 'Sub'
 
  > my $x = sub {}; say $x.^methods.^methods
  Parcel Capture elems item flat list lol at_pos postcircumfix​:<[ ]> STORE
  FLATTENABLE_LIST FLATTENABLE_HASH fmt of Bool Numeric Str ACCEPTS gist perl
  DUMP

  > my $x = sub {}; say $x.^methods.perl
  Method 'perl' not found for invocant of class 'Sub'

  > my $x = sub {}; say $x.^methods.DUMP
  maximum recursion depth exceeded

There are 40 of them, though​:

  > my $x = sub {}; $x.^methods.elems
  40

--
rjbs

@p6rt
Copy link
Author

p6rt commented Apr 9, 2013

From @jnthn

On Fri Nov 09 11​:44​:46 2012, rjbs wrote​:

I like that I can easily get a list of methods on a value​:

my $x = []; say $x.^methods
new bind_pos delete flattens REIFY STORE_AT_POS STORE
PARAMETERIZE_TYPE
at_pos perl new Bool Int end fmt flat list lol flattens tree Capture
Parcel
eager elems exists gimme infinite iterator munch pick pop roll
reverse
rotate shift splice sort classify categorize uniq REIFY STORE_AT_POS
FLATTENABLE_LIST FLATTENABLE_HASH keys values pairs kv reduce of
Numeric
Str at_pos push unshift ACCEPTS gist perl DUMP elems infinite item
fmt Int
Num chrs Numeric Str

It doesn't work on a Sub.

my $x = sub {}; say $x.^methods
Method 'gist' not found for invocant of class 'Sub'

my $x = sub {}; say $x.^methods.flat
Method 'Stringy' not found for invocant of class 'Sub'

my $x = sub {}; say $x.^methods.^methods
Parcel Capture elems item flat list lol at_pos postcircumfix​:<[ ]>
STORE
FLATTENABLE_LIST FLATTENABLE_HASH fmt of Bool Numeric Str ACCEPTS
gist perl
DUMP

my $x = sub {}; say $x.^methods.perl
Method 'perl' not found for invocant of class 'Sub'

The problems were thanks to Sub having various NQP routines installed in
the method table, for bootstrapping reasons. This subsequently blew up
operations like .^methods. Such foreign code objects now show up as the
Perl 6 type ForeignCode, thus resolving the issue.

Added tests to S12-introspection/methods.t; resolving ticket.

Thanks!

/jnthn

@p6rt
Copy link
Author

p6rt commented Apr 9, 2013

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

@p6rt
Copy link
Author

p6rt commented Apr 9, 2013

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

@p6rt p6rt closed this as completed Apr 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant