[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

automatic local variables



The reason why 

   fn foo  arg { * = frobme baby }

isn't good enough to avoid the shadowing of *, is that it shadows another
variable you might not want to shadow.  Imagine the following simple
sequence:

   * = arg arg2 arg3
   $*(1) = foo
   fn frob arg { $*(1) = bar }
   frob
   echo $$*(1)
   

The output you want is `bar'.  The output you *get* is `foo', because you
inadvertently shadowed a variable you wanted to modify by side effect.
This only happens if your table of variables is named `*'.  A bad choice
perhaps, but only because es is special casing the behavior of this
variable.