Ticket #77 (closed feature: invalid)

Opened 8 years ago

Last modified 5 years ago

Parrot::Interpreter - should support multi-level namespaces

Reported by: szabgab Owned by:
Priority: normal Milestone:
Component: hll_interop Version: trunk
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:


Rakudo uses two levels of namespaces while the find_global method of Parrot::Interpreter can handle only one level.

Attached is a test file that loads perl6.pbc and then tries to find it main sub.


perl6.t Download (0.8 KB) - added by szabgab 8 years ago.
cardinal.t Download (0.8 KB) - added by szabgab 8 years ago.
languages.t Download (0.9 KB) - added by szabgab 8 years ago.

Change History

Changed 8 years ago by szabgab


Changed 8 years ago by szabgab


Changed 8 years ago by allison

Language tests shouldn't be mixed in with core tests. Instead of adding separate test files in ext/Parrot-Embed/t/ for every language, add one test file ext/Parrot-Embed/t/languages.t, and test a core language (abc is guaranteed to be in the main repository through 1.0 and beyond).

If you want to test Parrot::Embed with other languages, those tests belong in languages/perl6/t/, languages/cardinal/t/, etc.

Changed 8 years ago by szabgab


Changed 8 years ago by szabgab

Proposed API

The initialization should be same as now

my $parrot = Parrot::Interpreter->new();

Allowing several levels of namespaces (currently only one is supported)

my $sub_pmc = $parrot->find_global( 'name_of_sub', 'Name', 'Space' );

This is what is in the docs currently but it only accepts a single $arg not @args

my $result_pmc  = $sub_pmc->invoke( $signature, @args );

Actually I don't understand why do we need to pass the signature here as parameter it would be more simple to have this

my $result_pmc  = $sub_pmc->invoke( @args );

But then also support these

my $result_pmc  = $sub_pmc->invoke( \@args );
my $result_pmc  = $sub_pmc->invoke( \%args );
my $result_pmc  = $sub_pmc->invoke( \%args, \%more_args, ... );

Some of the languages will be able to handle hash references as parameters.

I don't understand why does it get the $interpreter as a paramater in the docs I think this should be enough:

my $str = $result_pmc->get_string;

But probably also

my @data = $result_pmc->get_list;

Later maybe also


Later we can wrap them into something like

sub exe {
    my $result_pmc  = $sub_pmc->invoke( @_ );
    if (wantarray) {
        return $result_pmc->get_list;
    } else {
        return $result_pmc->get_string;

Changed 7 years ago by jkeenan

  • component changed from none to hll_interop

Changed 5 years ago by benabik

  • status changed from new to closed
  • resolution set to invalid

Parrot::Embed and Parrot::Interpreter have been removed from parrot. This ticket has been replaced with  https://github.com/parrot/parrot-embed/issues/1

Note: See TracTickets for help on using tickets.