MathGroup Archive 1990

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

Search the Archive

Parameter passing "feature"

  • To: mathgroup at
  • Subject: Parameter passing "feature"
  • From: David Jacobson <jacobson at>
  • Date: Sat, 6 Oct 90 21:13:22 pdt

When a function has the HoldAll (or HoldFirst or HoldRest) attributes,
there are possible name conflicts between symbols in actual parameters
(arguments) and local variable declared in blocks (and I presume
iterators, but I didn't check).  See the following example

In[1]:= SetAttributes[baz,HoldAll]

In[2]:= baz[x_] := {Block[{z=3},x],x}

In[3]:= baz[1]

Out[3]= {1, 1}

In[4]:= z=1

Out[4]= 1

In[5]:= baz[z]

Out[5]= {3, 1}

I'm not sure this is a bug, but I thought it was something some of you
would like to know about.  

  -- David Jacobson

  • Prev by Date: Flat esoterica
  • Next by Date: Gear method
  • Previous by thread: Flat esoterica
  • Next by thread: Parameter passing "feature"