Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

42
  • 2
    $\begingroup$ very clear. well-deserved +1 $\endgroup$ Commented Jan 23, 2012 at 23:36
  • 3
    $\begingroup$ @acl Thanks! I knew there will be many answers, but just could not resist:). I actually consider two of my strongest mma areas to be scoping and performance-tuning, so whenever there is a discussion on those, I go out of control, as you correctly noted some few days ago :) $\endgroup$ Commented Jan 23, 2012 at 23:40
  • $\begingroup$ You mentioned that Module-locale symbols with DownValues don't get garbage collected, which sounded worrying, so I tried Module[{a}, a[1] = 1; ] in a fresh kernel. In this case a (or rather its renamed version) does get garbage collected. Can you elaborate? $\endgroup$ Commented Jan 24, 2012 at 0:00
  • 3
    $\begingroup$ I think this if fairly complete, I just would like to mention another example why Block is dangerous: It can incidentally trigger Dynamic evaluations -- and in extreme cases hang or crash the FrontEnd. Evaluate this to see why: Dynamic[x] and then in another cell this: Block[{x},x=1;Pause[1]] $\endgroup$ Commented Jan 24, 2012 at 14:25
  • 2
    $\begingroup$ Another comment on the Dynamic example, maybe a little off topic: Would anyone except for me condider it as a bug that the Dynamic[x] will keep showing 1 even after Block[{x},x=1;Pause[1]] has finished and a shift-return-evaluation will show that x has no value defined anymore? Using a Clear[x] will make it update... $\endgroup$ Commented Jan 24, 2012 at 23:51