# What is the purpose of MatchLocalNameQ?

I found a kernel function which is undocument MatchLocalNameQ.But I don't know the purpose of it.

a = 1;
b = 1;
MatchLocalNameQ[a, b]


False

a = 1;
b = 1;
MatchLocalNameQ[a, a]


True

But what want to do really this function?It's useful to us?

• considering its name I'd expect it to check whether something is a local variable like in MatchLocalNameQ[Evaluate@Module[{a},a],a] which gives True. The second seems to be a "template" for which the local variable has been generated. Dec 18, 2016 at 16:51
• I think it's closely connected to MatchLocalNames, which gives a bit of a hint. Dec 18, 2016 at 16:56
• @corey979 Thanks,that is a reasonable guess(ping QuantumDot,too)
– yode
Dec 18, 2016 at 16:58

It checks whether the first argument is a Module-localized version of the second:
MatchLocalNameQ[x$1, x] (* True *)  Module localizes like this: Module[{x}, x] (* x$29141 *)