TikZ and the handling of some key-value pairs in \NewDocumentCommands

When defining parameters for the \draw command in a \NewDocumentCommand setting [help lines] is rejected, as are some other arguments, for example [ultra thin] etc., but [lime,thin] etc. are OK. Could there be something askew in the handling of the Expl3 key-value interface in TikZ? Evidentally, no such problems occur if using the LaTeX2 \newcommand.

\documentclass{article}
% RN. 28 March 2017
%=======================
\usepackage{xparse}
\usepackage{tikz}
%-----------------------
\ExplSyntaxOn
\NewDocumentCommand\myGrid{O{4}}
{
%\draw [help lines] (0,0) grid (#1,#1); => compiler ERROR
\draw [lime,thin] (0,0) grid (#1,#1);
}
\ExplSyntaxOff
%-----------------------
\begin{document}
\begin{tikzpicture}
\myGrid [10]
\end{tikzpicture}
\end{document}

• Well, in the expl3 regime, your spaces are ignored, i.e. help lines is seen as helpline which is most likely undefined. Your command does not make any use of expl3 features, so why do you use \ExplSyntaxOn there -- the \NewDocumentCommandetc. macro do not need it all (as front-end to expl3) – user31729 Mar 28 '17 at 12:07
• In that situation you would need help~lines (or help ~ lines, if you want it to look a bit more spaced up), because “spaces” are input with ~ inside expl3 code. – Manuel Mar 28 '17 at 12:11
• @Manuel: Yes, but since there are some pgfkeys with spaces inside, it will get tedious to preserve for them with ~ inside – user31729 Mar 28 '17 at 12:13
• @ChristianHupfer Yes, no doubt. I even asked to ignore spaces in expl3 keys as a result related of this problem with pgfkeys. But if it's for a few keys in a macro definition, then there's no problem with issuing ~. – Manuel Mar 28 '17 at 12:15
• @Manuel: Yes, for some few occurences this is perfectly alright. – user31729 Mar 28 '17 at 12:16

• One should also point out that ~ in the replacement text of a macro is normalized to a space token with character code 32 and category code 10, so when the TikZ scanning takes place, spaces are found where they should. Moreover, ~ is not removed at end of lines. – egreg Mar 28 '17 at 22:18
• I have learnt to appreciate the ~, slowly but surely. It certainly has fixed the problem here. Much obliged. While I am sure that @cfr makes a valid point when advising to separate the "normal package environment" from Expl3 and put TikZ stuff into the former, the argument goes over my head technically. I pretend that Expl3, which provides me with the\NewDocumentCommand and similar document level commands as well as the many functions introduced in the various references, is all there is and continue to refuse to look under the hood. – Reinhard Neuwirth Mar 29 '17 at 1:13