1 # Copyright (C) 2007-2009, Parrot Foundation.
6 Subroutines all have a unique name, which is how the software recognizes
7 them. However, if we have many functions this can be difficult because
8 they all would need to be uniquely named. Namespaces are special constructs
9 that allow us to reuse subroutine and global variables names, and to keep
12 Namespace PMCs are like Hash PMCs, so we can access different namespaces
13 with keys just like we would a hash. Namespaces can be nested to any
16 Using the C<set_global> and C<get_global> opcodes we can create, store,
17 and access variables in a different namespace.
25 set_global ["Different"; "Namespace"], "foo", $P0
28 $P1 = get_global ["Different"; "Namespace"], "foo"
37 # vim: expandtab shiftwidth=4 ft=pir: