On Sep 28, 2004, at 9:54 AM, Chip Salzenberg wrote:

According to Jeff Clites:
Let's say that all you have around are $Foo and $Foo::Bar::baz ...

top-level namespace (say this is namespace #1):
{
        variables => { Foo => <PerlScalar PMC (or whatever)> },
        namespaces => { Foo => <PerlNamespace PMC, call namespace #2> }
}

I'm a bit confused by this example. Don't you mean:

        variables => { '$Foo' => <PerlScalar PMC (or whatever)> },

i.e. with the '$' in the key?

Sorry, accidentally sidestepped the array/scalar/hash issue. Given $foo, @foo, and %foo, we could either do:


variables => { '$foo' => <whatever>,
                         '@foo' => <whatever>,
                         '%foo' => <whatever>
                        }

-or-

scalars => { 'foo' => <whatever> },
arrays => { 'foo' => <whatever> },
hashes => { 'foo' => <whatever> }

The infrastructure's the same, it just depends on whether we want to (at the Parrot level) think of Perl as having one category of variables, or three. We could even have:

scalars => { '$foo' => <whatever> },
arrays => { '@foo' => <whatever> },
hashes => { '%foo' => <whatever> }

...if we wanted to model Perl as having three categories, but still treat the sigils as part of the name.

I think the second option has the most potential for smooth interoperability with other languages.

Presumably, all of Pythons "stuff" would go in a single bucket in a Python-originating namespace. So it might look like:

{
        whatever => { a => <namespace>, b => <object>, c => <sub> }
}

Where there's only one category, and "whatever" could be "references" or "objects" or "variables" or "scalars" or whatever made the most sense from a cross-language standpoint. (I think the different semantics of Perl v. Python variables means that it might be appropriate for the categories to be different between the two languages, though Python and Ruby might match one another. But, as all Python variables are references, they're sorta-like Perl scalars, so maybe the category for Perl-scalars should be the same as that for Python-references--just depends on what works best for cross-language access, but the infrastructure's the same.)

And what I mean here is that how many categories are inside a given namespace depends on where it was created (in Perl code v. Python code, for example), but after that point the usage is the same.

JEff



Reply via email to