On Tuesday 01 August 2006 02:52, Leopold Toetsch wrote:

> Two things come to my mind:
> 1) why is it creating 2 interpreters?

Per my experiments, this worked out the best.  That is, if there's an error in 
the compiled code, reusing an interpreter gave weird answers.  I haven't 
tracked this down in more detail.

> What is the $parent used for? 

It's the parent of the interpreter created in the pir_output_*() functions.  
Creating new subsequent interpreters without providing $parent gave weird 
encoding assertion errors.

>    And related: is $interp ever cleaned up by calling Parrot_exit()?

Nope, but I'll put a destructor in Embed::Parrot::Interpreter when I get that 
far.

> 2) This looks a bit bogus (there is no 'V' signature char):
>
>   my $out_pmc = Parrot::Embed::call_sub( $interp, $sub, 'PV', '' );
>   my $output  = Parrot::Embed::get_string_from_pmc($interp, $out_pmc);
>
> It could just be:
>
>   my $output = Parrot::Embed::call_sub( $interp, $sub, 'Sv');
>
> by returning the STRING* directly.

True, but I prefer to use the PMC methods rather than fiddling around 
converting strings to and from the C format.  If this API changes to send and 
receive char * instead of STRING *, I'll happily use that.

-- c

Reply via email to