home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 June
/
PCWorld_2007-06_cd.bin
/
multimedia
/
ppsee
/
PPSeeSetup.exe
/
lib
/
bsh-commands-2.0b4.jar
/
bsh
/
commands
/
setNameSpace.bsh
< prev
next >
Wrap
Text File
|
2005-05-23
|
905b
|
44 lines
/**
Set the namespace (context) of the current scope.
<p/>
The following example illustrates swapping the current namespace.
<p/>
<pre>
fooState = object();
barState = object();
print(this.namespace);
setNameSpace(fooState.namespace);
print(this.namespace);
a=5;
setNameSpace(barState.namespace);
print(this.namespace);
a=6;
setNameSpace(fooState.namespace);
print(this.namespace);
print(a); // 5
setNameSpace(barState.namespace);
print(this.namespace);
print(a); // 6
</pre>
<p/>
You could use this to creates the effect of a static namespace for a
method by explicitly setting the namespace upon entry.
<p/>
*/
bsh.help.setNameSpace =
"usage: setNameSpace( bsh.NameSpace )";
setNameSpace( ns )
{
// Set the namespace at depth one (our caller) to the specified namespace.
this.callstack.set( 1, ns );
}