Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id p03DtV5j018125 for ; Mon, 3 Jan 2011 14:55:33 +0100 Received: (qmail 22490 invoked by alias); 3 Jan 2011 13:55:26 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 03 Jan 2011 13:55:24 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx047) with SMTP; 03 Jan 2011 14:55:24 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p03Drbbj021223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Jan 2011 14:53:37 +0100 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p03DM0Za013754; Mon, 3 Jan 2011 14:53:28 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 798905 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 3 Jan 2011 14:53:28 +0100 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p03DrRxU021860 for ; Mon, 3 Jan 2011 14:53:27 +0100 Received: from ueamailgate01.uea.ac.uk (ueamailgate01.uea.ac.uk [139.222.131.184]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p03DrFHp021075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 3 Jan 2011 14:53:19 +0100 Received: from ueams02.uea.ac.uk (ueams02.uea.ac.uk [139.222.131.131]) by ueamailgate01.uea.ac.uk (8.13.8/8.13.8) with ESMTP id p03DrFHW001177; Mon, 3 Jan 2011 13:53:15 GMT Received: from [139.222.113.126] by ueams02.uea.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1PZkqW-00061C-Gz; Mon, 03 Jan 2011 13:53:12 +0000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 References: <4D20D031.7040803@gmx.de> <4D20DAE9.3070306@morningstar2.co.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, outgoing) X-CanIt-Geo: ip=139.222.131.131; country=GB; region=I9; city=Norwich; latitude=52.6333; longitude=1.3000; http://maps.google.com/maps?q=52.6333,1.3000&z=6 X-CanItPRO-Stream: UEA:outgoing (inherits from UEA:default,base:default) X-Canit-Stats-ID: 66356393 - fc0db188a520 - 20110103 X-Scanned-By: CanIt (www . roaringpenguin . com) on 139.222.131.184 Message-ID: <4D21D4CA.70703@morningstar2.co.uk> Date: Mon, 3 Jan 2011 13:53:14 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: \int_eval:n versus \dim_eval:n/skip_eval:n [was Re: l3luatex module] To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p4U4jfdfC5HDevlx1X2sAZg1MkugZcpwIdDb8z5l6KEaP+LdZ7QLw+5CKzyp k5HTLZ1v8wPRqFdQdQapWq9qz59Rr52fCiljKsM85i3sbXAJVBjnzZkoSL42zBmmwDa5vja6zT3o 7boow==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6512 On 02/01/2011 21:03, Philipp Stephani wrote: > still it would be great if the behavior of the L3 macros were formally defined in TeX terms: I often experience that I cannot use certain L3 macros because it is not documented whether they expand to, say, an or an. \dimexpr ... \relax is guaranteed by the e-TeX manual to be an, but what \int_eval:n does is undocumented—in fact, it expands to an without trailing space, making things like > > \documentclass{minimal} > \usepackage{expl3} > \begin{document} > \newcount\x > \ExplSyntaxOn > \x = \int_eval:n { 1 + 1 } 1 > \ExplSyntaxOn > (\the\x) > \end{document} > > possible. 2e's counters and length were designed to make such effects impossible, but L3 reintroduces them :-( > \dim_eval:n, on the contrary, expands to an. I think that is the right choice because it is faster and leads to fewer problems. I think a formal description like the following would be nice: Looking at this again, it reminds me that I'd already been worried about the inconsistency between \int_eval:n and \dim_eval:n/\skip_eval:n. For reference, these are defined (effectively) as \cs_new:Npn \int_eval:n #1 { \number \numexpr #1 \relax } \cs_new:Npn \dim_eval:n #1 { \dimexpr #1 \relax } \cs_new:Npn \skip_eval:n #1 { \glueexpr #1 \relax } My original proposal to deal with this was to include \the in the \dim_eval:n and \skip_eval:n definitions. However, looking at it again perhaps a better plan would be to alter \int_eval:n to \cs_new:Npn \int_eval:n #1 { \numexpr #1 \relax } and say that all three functions need to be treated like the related variables: in a context where TeX expects an expression, no \_use:N is required but otherwise it is. (In all cases, \_use:N is let to \the.) So modifying Philipp's example to read \documentclass{minimal} \usepackage{expl3} \begin{document} \newcount\x \ExplSyntaxOn \cs_set:Npn \int_eval:n #1 { \numexpr #1 \relax } \x = \int_eval:n { 1 + 1 } 1 \ExplSyntaxOn (\the\x) \end{document} then gives the more logical result. The resulting documentation might read % Evaluates the \meta{integer expression}, expanding any % integer and token list variables within the \meta{expression} % to their content (without requiring \cs{int_use:N}/\cs{tl_use:N}) % and applying the standard mathematical rules. This process requires % two expansions. The result of the calculation is an % \meta{internal integer} which should be treated in the same way % as a \texttt{int} variable, \emph{i.e.}~it must be prefixed % by \cs{int_use:N} unless used in a context which requires an % \meta{integer expression}. (with similar statements for \dim_eval:n and \skip_eval:n). Is this sufficiently accurate and clear? Does the entire proposal make sense? -- Joseph Wright