MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Tempvar zombies littering my context!

  • To: mathgroup at
  • Subject: [mg114464] Re: Tempvar zombies littering my context!
  • From: kj < at>
  • Date: Sun, 5 Dec 2010 21:50:37 -0500 (EST)
  • References: <idd7ml$nae$>

I discovered a shockingly simple workaround to the problem I reported
in the original post of this thread: just use Block instead of

n[1]:= a[b_] := Block[{c, d},
   c[___] := (Print[c];);
   d[___] := (Print[d];);
   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.


  • Prev by Date: Re: Re-virginating Manipulates?
  • Next by Date: ANN: CMake module for Mathematica
  • Previous by thread: Tempvar zombies littering my context!
  • Next by thread: Re: Tempvar zombies littering my context!