Re: Creating a simple state inspector for Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg111871] Re: Creating a simple state inspector for Mathematica
- From: telefunkenvf14 <rgorka at gmail.com>
- Date: Mon, 16 Aug 2010 05:54:57 -0400 (EDT)
- References: <email@example.com> <firstname.lastname@example.org>
On Aug 15, 6:39 am, magma <mader... at gmail.com> wrote: > On Aug 14, 12:35 pm, "J. McKenzie Alexander" <ja... at lse.ac.uk> wrote:> Hi= , > > > I'm trying to create a simple "state inspector" for Mathematica. Ideall= y, > > I'd like to have a dynamically updated list of all the symbols in Globa= l`= > , > > with the option of displaying their values, and the ability to Clear= o= > > r Remove symbols by clicking on a button. Now, I've managed to put togeth= er= > something which *almost* does what I want, but it has a slight bug. Wh= at's= > the bug? You can Clear a symbol by clicking on the button named "Clear= ", b= > ut clicking on the button named "Remove" generates an error. I don't unde= rs= > tand why. Very interesting... Humble request: Can someone from WRI clear this up with a brief comment? (or ClearAll this up, if you'd prefer) Haha... me punny. -RG > the command Remove is very nasty! > I would not recommend anybody using it in a program (that is a > sequence of steps running ). > One should only use it directly, that is typing it by hand, if at all. > The reason is that when you remove a symbol (say x), a sort of shadow > or ghost lingers in memory and is called Removed[x] and all > definitions (in Set, SetDelayed and elsewhere) are modified in such a > way that occurrences of x are replaced with Removed[x], practically > making them unusable by Mathematica again, even if you give x a value aga= in. > So, I would simply NOT use Remove in your inspector. > Clear or ClearAll is enough for most reasonable things.