Can someone explain to my why `\foo` and `\bar` are not the same (in the `\ifx` sense) in this example:

```
\documentclass{article}
\begingroup
  \catcode`|=3\relax
  \gdef\abc{|}
\endgroup
\makeatletter
\newcommand\foobar{
  \begingroup
    \catcode`|=3\relax
    \def\abc{|}
    \@foobar
}
\newcommand\@foobar[1]{
  \xdef\foo{#1}
  \endgroup
}
\edef\bar{\abc}
\foobar{\abc}

\begin{document}
foo means ``\meaning\foo'' and bar means ``\meaning\bar'', but the ``meanings'' are
\ifx\foo\bar
  same
\else
  different
\fi
\end{document}

```

I included the `\@foobar` because I read somewhere that the `catcode` had to be changed before reading the macro parameter (I don't think it applies here, but I have no idea what I am doing).

The global definition of `\abc` (the one defined with `\gdef`) is | with catcode 3. I would like the local definition of `\abc` (the one defined with `\def`) to also be | with catcode 3. In my example the local `\abc` is | with catcode 12. Ultimately I would like to have `\foobar{\abc}` expand to | with catcode 3 without having `\abc` defined golbally.