On Sun Dec 16 21:18:31 2007, coke wrote: > From PDD19: > > =item .namespace <identifier> [deprecated] > > 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 symbol table. > 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. > > {{ NOTE: this variation of C<.namespace> and C<.endnamespace> are > deprecated. > They were a hackish attempt at implementing scopes in Parrot, but > didn't > actually turn out to be useful.}} > > =item .endnamespace <identifier> [deprecated] > > Closes the scope block that was opened with .namespace <identifier>. > >
hi, the .namespace <ident> + .endnamespace directives are deprecated. this is because initially they were meant to implement scoping, but this didn't work out. We have .lex now to do that. However, simple languages that don't have closures still could use it. In fact, Jako uses it. It's a lightweight (=cheaper than .lex I think?) scope mechanism, which prevents that language implementers must implement it themselves. I'm not an advocate of these directives, in the sense that I'd like to remove or keep them. I don't use them. However, parrot's customers are language implementers (amongst others). Providing infrastructure to do what they want is a bonus for them. So, is the .namespace <ident> + .endnamespace pair really superfluous, and should they be removed, or might there be some advantage in keeping them? If not, then I'll remove them somewhere in the next few weeks. comments welcome, kjs