On Sep 28, 2004, at 8:58 AM, Jeff Clites wrote:

And just to close the loop, you'd still express your $Foo::Bar::baz lookup like:

lookupVariableInNamespace P1, ["Foo"; "Bar"], "baz" # the things in the [...] are always namespace names

Here are more examples, just to be clear:

(and the actual op names would be different, but I'm trying to be unambiguous here):


# $Foo::Bar::baz, or presumably Python's Foo.Bar.baz lookupVariableInNamespace P1, ["Foo"; "Bar"], "baz"

# $::foo, or "foo" as a variable in the top-level namespace
lookupVariableInNamespace P1, [], "foo"

# &Foo::bar
lookupSubInNamespace P1, ["Foo"], "bar"


Now, the above are shortcuts (or optimizations) for the generalized op: lookupInNamespace P1, ["Foo"; "Bar"], .VARIABLE, "baz"

And, they're also shortcuts for doing things more "manually":
# $Foo::Bar::baz
lookupNamespaceInNamespace P0, [], "Foo" # or rootNamespace P0
lookupNamespace P1, P0, "Bar" #lookup namespace "Bar" in namespace in P0
lookupVariable P2, P1, "baz"  #lookup variable "baz" in namespace in P1


And if we must treat the sigil as part of the name for Perl6 at the parrot level, we just get stuff like:


# $Foo::Bar::baz
lookupVariableInNamespace P1, ["Foo::"; "Bar::"], "$baz"

But, it seems better to not do that.

JEff



Reply via email to