> \exp_args:Nxx \setmathfont
> { \tl_use:N \c__test_MathFont_tl }
> { [ \tl_use:N \c__test_MathFontSpec_tl ] }
>
> Thanks for the explanations but this form does not work
the x expansion leaves in the braces so this ends up as
\setmainfont{somefontname}{[expansionof \c_...]}
but the braces prevent the optional argument from being seen.
it's not really an expl3 (or xetex) question, you would see the same with
\edef\foo{\noexpand\setmainfont{\zzz}{[\qqq]}}
\foo
(which is more or less what x-expansion is)