# Odd problem with Module and Block [duplicate]

I found some bizarre phenomena in my code. While I'm using Module in my function, the result is incompatible with which I did outside Module, and when I replaced Module with Block it went back to normal. I don't know why.

Edit:

Now the problem becomes this:

Module[{a,b},
a=Sin[x];
b[x_]=a;
b[y]
]


doesn't give Sin[y], while Block gives Sin[y].

• @Kuba I have found the problem. It seems that my attmption ϕ[x_] = ϕx to make ϕ a pure function failed, so all the following ϕs are function of x. When I change to Block, it seems fine again. Can you help me up with this? – Turgon Apr 21 '17 at 10:36
• Many thanks for the edit. Now it is clear you should read this: Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs or just use the solution - Set @@ {b[x_], a} – Kuba Apr 21 '17 at 11:01
• @Kuba Thanks a lot. That solved my problem. And really sorry about the inconvenience I brought earlier. – Turgon Apr 21 '17 at 11:10
• No worries, it happens, what doesn't happen so often is what you did with the edit so thanks. – Kuba Apr 21 '17 at 11:12