woops, I used tabs to indent, that gives ugly layout. Here's a NEW
version with spaces.
regards,
klaas-jan
Klaas-Jan Stol wrote:
hi,
In the current docs of PIR, the
.namespace <id>
.endnamespace <id>
directives are not mentioned.
This patch adds a short description of both to syntax.pod.
Regards,
klaas-jan
------------------------------------------------------------------------
--- syntax.pod 2005-08-08 19:44:47.000000000 +0200
+++ syntax_patched.pod 2005-08-25 16:02:33.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
# $Id: syntax.pod 8745 2005-07-30 17:35:35Z chromatic $
=head1 NAME
@@ -176,6 +176,29 @@
Define a named constant of style I<type> and value I<const>.
+=item .namespace <identifier>
+
+Open a new scope block. This "namespace" is not the same as the
+.namespace [ <identifier> ] syntax, which is used for storing subroutines
+in a particular namespace in the global symboltable.
+This directive is useful in cases such as (pseudocode):
+
+ local x = 1;
+ print(x); # prints 1
+ do # open a new
namespace/scope block
+ local x = 2; # this x hides the previous x
+ print(x); # prints 2
+ end # close the
current namespace
+ print(x); # prints 1 again
+
+All types of common language constructs such as if, for, while, repeat and such
+that have nested scopes, can use this directive.
+
+=item .endnamespace <identifier>
+
+Closes the scope block that was opened with .namespace <identifier>.
+
+
=item .namespace [ <identifier> ]
=item .namespace [ <identifier> ; <identifier> ]
--- syntax.pod 2005-08-25 16:13:16.000000000 +0200
+++ syntax_patched.pod 2005-08-25 16:13:59.000000000 +0200
@@ -176,6 +176,29 @@
Define a named constant of style I<type> and value I<const>.
+=item .namespace <identifier>
+
+Open a new scope block. This "namespace" is not the same as the
+.namespace [ <identifier> ] syntax, which is used for storing subroutines
+in a particular namespace in the global symboltable.
+This directive is useful in cases such as (pseudocode):
+
+ local x = 1;
+ print(x); # prints 1
+ do # open a new namespace/scope block
+ local x = 2; # this x hides the previous x
+ print(x); # prints 2
+ end # close the current namespace
+ print(x); # prints 1 again
+
+All types of common language constructs such as if, for, while, repeat and such
+that have nested scopes, can use this directive.
+
+=item .endnamespace <identifier>
+
+Closes the scope block that was opened with .namespace <identifier>.
+
+
=item .namespace [ <identifier> ]
=item .namespace [ <identifier> ; <identifier> ]