Ticket #1442 (new todo)

Opened 12 years ago

Last modified 12 years ago

Sub PMC should support getattribute

Reported by: Austin_Hastings Owned by:
Priority: normal Milestone:
Component: none Version: 2.0.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

The Sub PMC identifies itself, under class, as being an instance of the Class class.

Querying the Sub's Class for available attributes ($class.inspect('attributes')) returns a hash just chock full of goodness.

Sadly, attempting to request those attribute from the Sub doesn't work.

I believe that Sub should deliver on its promises, and provide the getattribute interface.

Alternatively, if Sub is going to require inspect to fetch the data, then the PMC class should not report those fields as attributes.

Change History

Changed 12 years ago by Austin_Hastings

Here's what I'm talking about:

austin@andLinux:~/kakapo$ cat test.nqp
Foo::foo();

module Foo;

sub foo() {
	my &sub := Foo::foo;
	my $class := pir::class__PP(&sub);
	my %attrs := $class.inspect('attributes');

	for %attrs {
		say($_);
	}
}


austin@andLinux:~/kakapo$ parrot-nqp test.nqp
outer_ctx
method_name
name
proxy
eval_pmc
HLL_id
namespace_name
ctx
namespace_stash
ns_entry_name
lex_info
vtable_index
subid
outer_sub
multi_signature

Changed 12 years ago by bacek

Actually, values from Sub.inspect should be used in Sub.inspect_str, not Sub.getattribute.

Note: See TracTickets for help on using tickets.