On Tue, 2003-10-28 at 19:26, Dan Sugalski wrote:
> On Tue, 28 Oct 2003, Anuradha Ratnaweera wrote:
> 
> > 2. If the ansewr to 0 or 1 is "no", will there be another standard in
> > Perl 6?
> 
> Yes. Whatever we do for Parrot.

Thigs are getting clearer and more confusing ;-)

I am still in the trying-to figure-out-what-the-hell-is-going-on-here
phase so please bear with me about the stupid questions ;-)

Let me ask one more, and hopefully the last, question; a specific one
this time:

Say, there is a C library x (libx.{so,a}) which defines a function foo()
which takes a single argument `struct bar'.  The prototype of foo() is
defined in x.h as:

    foo(struct bar);

Actual definition might be a typedef insted of struct bar itself, but
all the same.

And struct bar has three members: int a, char *b and struct morebar *c.

Now, if one wants to create a Perl[56] binding to the library x, s?he
will create a module X.  A script would look like:

use X;

my %bar = ();
my %morebar = ();

$morebar{key} = 10;
$morebar{value} = "ten";

$bar{a} = 10;
$bar{b} = 'bar b';
$bar{c} = \%morebar;

foo($bar);

Now, what exactly is going to happen when it comes to the foo($bar)
call?  Is $bar going to be duplicated to match struct bar?  Will there
be too much overhead when compared to a C implementation?

What I am looking for is something like this: The X.pm module will have
information about struct bar.  Using that, the script will be compiled
so that the hash will contain values for indices a, b and c in order and
in the same format as C does, so that foo($bar) call can happen without
minimal intermediate conversion steps.

Thanks.

        Anuradha

-- 

http://www.linux.lk/~anuradha/


Reply via email to