Re: Tempvar zombies littering my context!
- To: mathgroup at smc.vnet.net
- Subject: [mg114464] Re: Tempvar zombies littering my context!
- From: kj <no.email at please.post>
- Date: Sun, 5 Dec 2010 21:50:37 -0500 (EST)
- References: <idd7ml$nae$1@smc.vnet.net>
I discovered a shockingly simple workaround to the problem I reported in the original post of this thread: just use Block instead of Module! n[1]:= a[b_] := Block[{c, d}, c[___] := (Print[c];); d[___] := (Print[d];); c[]; d[] /; b === 1 ]; In[2]:= a[1]; During evaluation of In[2]:= c During evaluation of In[2]:= d In[3]:= a[2]; During evaluation of In[3]:= c In[4]:= Names[$Context <> "*"] Out[4]= {"a", "b", "c", "d"} (Granted, this may be only a workaround rather than a full solution. It all depends on whether what I reported originally was "a bug or a feature". If it was a bug (and an undocumented behavior of lingering tempvar zombies sure looks like a bug to me), then the fix can be done only by Wolfram's personnel.) As an unexpected bonus, this solution *also* fixes something that was a minor vexation: the extra junk (e.g. $1234) at the end of variable names printed from within Module. This is a rare occurrence indeed: a fix to one problem that also fixes another problem that was (at least in my mind) entirely unrelated to the first one. ~kj