1 # Copyright (C) 2007-2009, Parrot Foundation.
4 =head1 Subroutines in a Namespace
6 Subroutines created in one namespace can be accessed from another
7 using the C<get_global> opcode, just like global variables. In fact,
8 since subroutines are really just PMCs, they are variables themselves
9 and the two operations are actually the same.
11 Namespaces can be defined in code using the C<.namespace> directive,
12 followed by the name of the namespace as a hash key. The default root
13 namespace can be specified with an empty set of brackets such as
21 $P0 = get_global ["Different"; "Namespace"], "foo"
28 .namespace ["Different"; "Namespace"]
33 .local string greeting
34 greeting = "Hello, " . name
43 # vim: expandtab shiftwidth=4 ft=pir: