MathGroup Archive 2010

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

Search the Archive

Re: looping

Andrzej Kozlowski wrote:
> On 25 Jan 2010, at 11:08, Leonid Shifrin wrote:
>> Besides, changes to this seem unlikely because this
>> is a fundamental mechanism behind scoping in Module, and it has been this
>> way for a very long time (I don't know since which version but I wouldn't be
>> surprised if it  was there already in version 1).
> Actually there was no Module in version 1. (e.g. see the documentation for Module). Module was introduced in Version 2. Version 1 had only Block.
> Andrzej Kozlowski
> (Nice tricks, by the way. I have know about some of them for a long time but others are new to me.)
Oh dear.  As I pointed out in 1992, the Module mechanism is flawed.
Module makes up names,

as you can see by  g1[x_]:=Module[{r}, r]

with dollar signs.  e.g. I got  r$592  one time.

The standard advice is you can avoid conflict yourself by not using 
names with dollar signs in them.

  Unfortunately, if you have several independent programs perhaps 
written by different people and they each generate persistent names via 
  Module[{...,r...} ...] and you load them into the same system  then 
THEY can conflict.


run it a bunch of times.  Save g1 and A in file f1
start up a new system

run it a bunch of times.  Save g2 and A in file f2.
start up a new system

load files f1 and f2.

the behavior of g1 and g2 will be, so far as I can tell, dependent on
the (random?) setting of some inaccessible counter in Mathematica.

  • References:
    • looping
      • From: glenn kuhaneck <>
    • Re: Re: looping
      • From: Leonid Shifrin <>
  • Prev by Date: Re: Frame
  • Next by Date: Re: looping
  • Previous by thread: Re: Re: Re: looping
  • Next by thread: Re: looping