# How to expandafter an environment?

I have the following problem: I want to create a beamer presentation and introduced a new environment using xparse. The environment has one optional argument (+ two mandatory). Now I want to create an overlay effect such that on frame 1 the optioal argument is of a value and on frame 2 it should be not there. I thought of something like

\begin{MyEnv}{...}\alt<2->{}{[a]} ...


This leads not to the expected behavior as \alt is evaluated after the environment is opened. I thought of adding \expandafter before the \begin{MyEnv} but that did not help.

Below is a minimal working example.

One idea was to use the empty string to indicate that no argumnt is given. This is critical as the argument seems to be incorrctly expanded. There ia a second question about the described problem.

\documentclass[a4paper,10pt]{article}
\usepackage{xparse}
\NewDocumentEnvironment{MyEnv}{m O{x}}{Start (#1, #2)\par}{\par End}
\newcommand{\argument}{[o]}
\begin{document}
\begin{MyEnv}{a}
OK
\end{MyEnv}

\begin{MyEnv}{a}[b]
OK
\end{MyEnv}

\begin{MyEnv}{a}\argument{}
Not OK (should be a,o)
\end{MyEnv}
\end{document}


\expandafter\begin{MyEnv}

would expand the token after \begin except that is { which is not expandable so the \expandafter has no effect.
 \def\foo{\begin{MyEnv}}