| Author |
Message |
bennys
Joined: 18 Aug 2005
Posts: 2
|
Posted:
Mon Oct 31, 2005 1:10 pm Post subject:
is there a way to delete global variables? |
|
|
once a variable is defined (for example by a=5)
is there a way to remove it from the memory without exiting cadence?
(after which an error "*Error* toplevel: undefined variable - a" should
appear in the CIW when trying to access the variable a)
|
|
| Back to top |
|
 |
Andrew Beckett
Guest
|
Posted:
Mon Oct 31, 2005 5:10 pm Post subject:
Re: is there a way to delete global variables? |
|
|
On 31 Oct 2005 04:14:09 -0800, "bennys" <bennys@il.ibm.com> wrote:
| Quote: | once a variable is defined (for example by a=5)
is there a way to remove it from the memory without exiting cadence?
(after which an error "*Error* toplevel: undefined variable - a" should
appear in the CIW when trying to access the variable a)
|
a='unbound
would do it.
Andrew. |
|
| Back to top |
|
 |
Trevor Bowen
Guest
|
Posted:
Mon Oct 31, 2005 5:10 pm Post subject:
Re: is there a way to delete global variables? |
|
|
is there a way to remove it from the oblist?
gc() - doesn't seem to help...
Andrew Beckett wrote:
| Quote: | On 31 Oct 2005 04:14:09 -0800, "bennys" <bennys@il.ibm.com> wrote:
once a variable is defined (for example by a=5)
is there a way to remove it from the memory without exiting cadence?
(after which an error "*Error* toplevel: undefined variable - a" should
appear in the CIW when trying to access the variable a)
a='unbound
would do it.
Andrew. |
|
|
| Back to top |
|
 |
Andrew Beckett
Guest
|
Posted:
Mon Oct 31, 2005 5:10 pm Post subject:
Re: is there a way to delete global variables? |
|
|
On Mon, 31 Oct 2005 09:48:47 -0600, Trevor Bowen <m27315@gmail.com> wrote:
| Quote: | is there a way to remove it from the oblist?
gc() - doesn't seem to help...
|
No. Once a symbol is in the symbol table, it's there until you exit. Note, a
variable does not have to be created for something to end up in the oblist -
doing:
a='someSymbol
will put someSymbol in the symbol table (note, oblist is really a mirror of the
internal symbol table, in list form). There is no garbage collection of symbols,
which is why you should be very careful about using symbols as dynamic data
structures.
That said, doing something like this:
a=myVar
will also put myVar in the symbol table, with a value of unbound. So it's no
different having an uninitialised variable than a variable which has been set to
unbound.
The amount of saving (in normal situations) by removing a symbol from the symbol
table is likely to be very small, so there is little benefit in doing this.
Regards,
Andrew. |
|
| Back to top |
|
 |
Trevor Bowen
Guest
|
Posted:
Mon Oct 31, 2005 9:10 pm Post subject:
Re: is there a way to delete global variables? |
|
|
Thanks for the insight, Andrew!
Andrew Beckett wrote:
| Quote: | On Mon, 31 Oct 2005 09:48:47 -0600, Trevor Bowen <m27315@gmail.com> wrote:
is there a way to remove it from the oblist?
gc() - doesn't seem to help...
No. Once a symbol is in the symbol table, it's there until you exit. Note, a
variable does not have to be created for something to end up in the oblist -
doing:
a='someSymbol
will put someSymbol in the symbol table (note, oblist is really a mirror of the
internal symbol table, in list form). There is no garbage collection of symbols,
which is why you should be very careful about using symbols as dynamic data
structures.
That said, doing something like this:
a=myVar
will also put myVar in the symbol table, with a value of unbound. So it's no
different having an uninitialised variable than a variable which has been set to
unbound.
The amount of saving (in normal situations) by removing a symbol from the symbol
table is likely to be very small, so there is little benefit in doing this.
Regards,
Andrew. |
|
|
| Back to top |
|
 |
|
|
|
|