Author: chip Date: Sat Jul 1 12:27:31 2006 New Revision: 13097 Modified: trunk/docs/pdds/pdd21_namespaces.pod
Log: Consistently describe namespace identifiers accepted by namespace opcodes as either key constants or string arrays, since both of those work in all cases (or should :-)). Modified: trunk/docs/pdds/pdd21_namespaces.pod ============================================================================== --- trunk/docs/pdds/pdd21_namespaces.pod (original) +++ trunk/docs/pdds/pdd21_namespaces.pod Sat Jul 1 12:27:31 2006 @@ -18,8 +18,8 @@ =item - Namespaces should be hierarchical -=item - Add a get_namespace opcode (that takes an array or a multidimensional -hash index) +=item - The get_namespace opcode takes a multidimensional hash key or an array +of name strings =item - Namespaces follow the semantics of the HLL in which they're defined @@ -236,8 +236,8 @@ (that's Perl 5 syntax), then get_name() on that namespace returns an array of "perl5", "Some", "Module". -NOTE: Due to aliasing, this value may be wrong, even if nobody's been playing -around with it. +NOTE: Due to aliasing, this value may be wrong -- i.e. it may disagree with +the namespace name with which you found the namespace in the first place. =back @@ -307,40 +307,46 @@ =item add_namespace $P0, $P1 -Add the namespace PMC $P1 as the namespace $P0 (an array of names or a -multidimensional hash index). +Add the namespace PMC $P1 under the name denoted by $P0 (an array of names or +a multidimensional hash index). =item del_namespace $P0 Delete the namespace $P0 (an array of names or a multidimensional hash index). -=item $P0 = find_global $P1, $S0 - -=item $P0 = find_global $S0 +=item $P0 = get_namespace -Find $P0 as the variable $S0 in the current namespace. or in $P1, relative -to the HLL root namespace. +Set $P0 to the current namespace (i.e. the namespace of the currently +executing subroutine). =item $P0 = get_namespace $P1 -=item $P0 = get_namespace +Get the namespace denoted by C<$P1> (an array of names or a multidimensional +hash index) and store it in C<$P0>. -Get the namespace $P1 (an array of names or a multidimensional hash index) or -the current namespace. To get the "Foo::Bar" namespace, one would use this: +Thus, to get the "Foo::Bar" namespace, if the name is known at compile time, +one could use this opcode: - $P0 = split "::", "Foo::Bar" - $P1 = get_namespace $P0 + $P0 = get_namespace ["Foo"; "Bar"] -or this: +or, if the name is not known at compile time, this idiom: + + $P1 = split "::", "Foo::Bar" + $P0 = get_namespace $P1 + +=item $P0 = find_global $P1, $S0 + +=item $P0 = find_global $S0 - $P1 = get_namespace ["Foo"; "Bar"] +Find $P0 as the variable $S0 in the current namespace. or in $P1 (an array of +names or a multidimensional hash index), relative to the HLL root namespace. =item store_global $P1, $S0, $P0 =item store_global $S0, $P0 -Store $P0 as the variable $S0 in the current namespace, or in $P1, relative -to the HLL root namespace. +Store $P0 as the variable $S0 in the current namespace, or in $P1 (an array of +names or a multidimensional hash index), relative to the HLL root namespace. =back