I have a question about modules and local variables.
Here's my example:
h = 5;
Module[{a, h}, a[h_]= h^2; a[4]]
(*Out[2] = 25*)
I expected the module to return 16 and not 25! I believed h to be a LOCAL variable of the module!
I know that the following alternatives work and return correctly 16
Module[{a, h}, a[h_] := h^2; a[4]]
Module[{a, h}, a[h]=a[h] = h^2; a[4]]
Module[{a, j}, a[j_]=a[j_] = j^2; a[4]] (* with j a variable not previously defined *)
Block[{a, h}, a[h_]=a[h_] = h^2; a[4]]
Question: why does the module behave like that? i.e. why does it return 25 and not 16?
P.S. I am running out of variables and I am then resorting to modules to avoid errors due to variables defined more than once. I played a bit with modules to check their properties and I ran in this example.
Thanks for your help!