Re: Slow plotting of reflected parametric "butterflies"
- To: mathgroup at smc.vnet.net
- Subject: [mg124513] Re: Slow plotting of reflected parametric "butterflies"
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 22 Jan 2012 07:23:37 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 1/21/12 at 5:20 AM, cy56 at comcast.net (Chris Young) wrote: >I'm thinking that it's much safer programming style to always >isolate any functions using Set (rather than SetDelayed) inside a >module; otherwise aren't there "exposed" global variables? If these >get assigned some value, wouldn't the function be broken? I don't agree using Set is any safer/riskier than SetDelayed. But I do agree it is important to understand the difference between them and when each is appropriate. Localizing variables inside Module clearly isolates them from the external environment. But Module localizes variables by creating new variables which can cause unexpected difficulties. That is: In[1]:= a = 2; {Module[{a = 4}, {Names["a*"], 4}], a} Out[2]= {{{a,a$2093},4},2} Contrast that with In[1]:= a = 2; {Block[{a = 4}, {Names["a*"], 4}], a} Out[2]= {{{a},4},2}