Is it okay to put commands from xparse inside functions created by \cs_new:Npn instead of \NewDocumentCommand? Would that be a confusion of programming levels?
The example below works but I was wondering if it conforms to LaTeX3 conventions.
It tests #1 for -NoValue-; but #1 is an optional argument to public \create not to private \__mypkg_create.
mypkg.sty:
\RequirePackage{expl3}
\ProvidesExplPackage{mypkg}{2013/01/20}{0.01}{My Package}
\RequirePackage{xparse}
\NewDocumentCommand \foo {om}
{
\__mypkg_foo:nn {#1} {#2}
}
\cs_new:Npn \__mypkg_foo:nn #1#2
{
\IfNoValueTF {#1} {true} {false}
}
\endinput
sample.tex:
\documentclass{article}
\usepackage{mypkg}
\begin{document}
\foo{bar}
\end{document}
Edit:
mypkg.sty:
\RequirePackage{expl3}
\ProvidesExplPackage{mypkg}{2013/01/20}{0.01}{My Package}
\RequirePackage{xparse}
\NewDocumentCommand \foo {om}
{
\mypkg_foo:nn {#1} {#2}
}
\cs_new:Npn \mypkg_foo:nn #1#2
{
\IfNoValueTF {#1} {true} {false}
}
\endinput