Chip Salzenberg <[EMAIL PROTECTED]> wrote:
> According to Brent 'Dax' Royal-Gordon:
> > (This does pose a problem going the other way, but I suspect Perl
> > could simply mark its own packages in some way, and fall back to a
> > simpler scheme, such as "ignore the sigil", when it's munging another
> > language's namespaces.)
>
> Could you unpack this 'problem', and give an example?

For the sake of argument, assume that we go with the latter scheme,
and somebody writes this in Perl:

    $python::Foo::Bar::baz

A naive Perl 6 compiler would convert that to something like

    find_global P0, ["ns"; "python"; "ns"; "Foo"; "ns"; "Bar"; "scalar"; "baz"]

But, since it's a Python namespace, it should really be looking up

    find_global P0, ["python"; "Foo"; "Bar"; "baz"]   #possibly with
an "ns" in front

One possible solution is to have a Perl 6 version of find_global:

    find_global_p6 P0, ["::python"; "::Foo"; "::Bar"; "$baz"]

When find_global_p6 operated on a Perl6Stash (or somesuch), it would
use the sigil to find the appropriate type namespace; when it operated
on any other type of stash, it would strip off the sigils and do a
normal lookup.  Thre are other solutions, of course, and I suspect
that many of them would be better than this one...

--
Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]>
Perl and Parrot hacker

There is no cabal.
[I currently have a couple Gmail invites--contact me if you're interested.]

Reply via email to