summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-02-28 00:40:51 +0000
committerKarl Berry <karl@freefriends.org>2012-02-28 00:40:51 +0000
commit29c459636115f7de4ae9a8681927b52a1e896805 (patch)
tree5200a1da0c7a7bae64d8c07c48df4a5daf30323e /Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex
parente20ea4bdd670e0418363a2a38a54b422a4d83231 (diff)
l3kernel 3471 (26feb12)
git-svn-id: svn://tug.org/texlive/trunk@25525 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex')
-rw-r--r--Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex21
1 files changed, 16 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex
index c14d7d8eefd..4f63ed8fc70 100644
--- a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex
+++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File l3styleguide.tex Copyright (C) 2011 The LaTeX3 Project
+File l3styleguide.tex Copyright (C) 2011,202 The LaTeX3 Project
It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -155,19 +155,30 @@ look like the example:
\section{Code conventions}
+All code-level functions should be \enquote{long} if they accept any
+arguments, even if it seems \enquote{very unlikely} that a \cs{par} token.
+will be passed. Thus \cs{cs_new_nopar:Npn} and so forth should only be used
+to create functions which accept no arguments at all.
+
+The expandability of each function should be well-defined. Functions which
+cannot be fully expanded must be \texttt{protected}. This means that expandable
+functions must themselves only contain expandable material. Functions which
+use any non-expandable material must be defined using \cs{cs_new_protected:Npn}
+or similar.
+
When using \cs{cs_generate_variant:Nn}, group related variants together
to make the pattern clearer. A common example is variants of a function
which has an \texttt{N}-type first argument:
-\begin{verbatim*}
-\cs_generate_variant:Nn \foo:Nn { NV , No }
-\cs_generate_variant:Nn \foo:Nn { c , cV , co }
+\begin{verbatim}
+ \cs_generate_variant:Nn \foo:Nn { NV , No }
+ \cs_generate_variant:Nn \foo:Nn { c , cV , co }
\end{verbatim*}
There are cases where omitting braces from \texttt{o}-type arguments
is desirable for performance reasons. This should only be done if the
argument is a single token, thus for example
\begin{verbatim}
-\tl_set:No \l_some_tl \l_some_other_tl
+ \tl_set:No \l_some_tl \l_some_other_tl
\end{verbatim}
remains clear and can be used where appropriate.