On Wed, 2004-09-08 at 18:02, Richard Jolly wrote:

> Can you really do this:
> 
> #!/usr/bin/perl6
> use __Python::sys;                # whatever syntax
> sys.stdout.write( 'hi there');    # perl6 syntax matches python syntax 

There's some confusion in the responses between syntax merging (not
appropriate for p6i, and not really what you asked) and access to
modules in other languages.

Yes, what you ask is essentially possible. It's not clear that you would
use ".", though the way python does module heirarchies, maybe (it sort
of is closer to a method invocation rather than a sub-namespace).

Parrot represents namespaces, calling conventions and high level data in
generic ways so that they can be moved between languages which might
have different syntax and semantics.

Because of that something like:

        foo("bar", 1, new Chunder);

in Perl 5 / Ponie could easily call a "foo" that was defined in some
other Parrot language, say Python:

        def foo (x, y, z):
                print "String was %s, number was %d, other %s"%(
                        x, y, z.yawn())

In the case of the string, Python would get a PMC which it could perform
all of the normal string operations on, even though it would be a
Perlish string object rather than a pythonish string object.

Same basic deal in terms of the number.

In the case of the objet, Python would get a PMC object which has a
means of invoking a method. Python would invoke "yawn" on z with no
parameters and the Perl:

        package Chunder;
        ...
        sub yawn { my $self = shift; print "Now yawning\n" }

would be invoked as normal.

-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Reply via email to