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 o8MCIAuF020363 for ; Wed, 22 Sep 2010 14:18:11 +0200 Received: (qmail 6340 invoked by alias); 22 Sep 2010 12:18:05 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 22 Sep 2010 12:18:04 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx035) with SMTP; 22 Sep 2010 14:18:04 +0200 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 o8MCHkrF022888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Sep 2010 14:17:47 +0200 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 o8MBRbvj010542; Wed, 22 Sep 2010 14:16:08 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 451119 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 22 Sep 2010 14:16:08 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id o8MCG8Wl013278 for ; Wed, 22 Sep 2010 14:16:08 +0200 Received: from csep02.cliche.se (csep02.cliche.se [195.249.40.184]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id o8MCFCiu023640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Sep 2010 14:15:21 +0200 Received: from nova.local (unknown [130.239.119.168]) by csep02.cliche.se (Postfix) with ESMTP id 2D89E185B92 for ; Wed, 22 Sep 2010 14:15:42 +0200 (CEST) User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 References: <4C9905B4.2080802@morningstar2.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id o8MCG8Wl013279 Message-ID: <4C99F36F.5010106@residenset.net> Date: Wed, 22 Sep 2010 14:15:43 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: =?ISO-8859-1?Q?Lars_Hellstr=F6m?= Subject: Re: Quarks: revisions of use in expl3 To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4C9905B4.2080802@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p4WX0t+AtsdW2ORvUlAfcdS0skAdU0CyDpncVxtUMPpOqI3gH81aZIXD1cH3 5ETx5RtA06hG3EktnRGhfE2oxt+RU0e7F8YpJ9eB28exjgx7xl4PJV7d6l42PTMYFOttFGsL2SlK x2C0A==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: 6437 Joseph Wright skrev 2010-09-21 21.21: > Hello all, > > The documented use for different quarks in expl3 is broadly as follows: > - \q_stop and \q_mark for delimiting arguments, with \q_stop used > mainly > - \q_nil as a nil pointer \begin{remark} Which seems a very odd concept to have within TeX, but should probably be interpreted as "something that would have been a nil pointer, had LaTeX been implemented in LISP" (which it of course isn't, but allegedly Lamport drafted LaTeX in some sort of LISP pseudocode). \end{remark} > - \q_no_value to indicate the absence of a value at all > > However, the use of these quarks in expl3 has been rather less well > defined, with \q_nil in particular used in places where \q_stop is most > appropriate. We've therefore revised the applications, and the SVN > version of expl3 is now much more systematic in this regard. > > In the main, this change should not affect the code others are using as > these are mainly internal features. However, one place that the > difference may impact is \tl_head:w and \tl_tail:w. These now terminate > with \q_stop not \q_nil. > > There will be a CTAN update of expl3 and xpackages soon (by the > weekend, I hope). This will include these changes (along with others: > see my other e-mails). Since I was successful regarding the boolean syntax, I think I'd better try reraising a point regarding quarks as well. Claim 1. The main property required for a quark is that it is a control sequence that is distinct from everything that could reasonably be constructed from normal materials; in particular, it must be such that the delimited argument in a \def\macro#1\quark{...} grabs material up to precisely that quark (and no other quark). Claim 2. The only other property employed is that it is possible to test a sequence #1 of tokens for being \quark_X by doing \def\temp_a{#1} \ifx \temp_a \quark_X Claim 3. These properties are obtained by defining a quark as a macro that expands to itself. Since the control sequence is contained in its own definition, the resulting macro contains the information of which quark it is, and it is thus distinct from other quarks. This does however lead to the main problem with quarks, that the documentation sternly warns about: if you ever were to attempt a full expansion of a quark then TeX would get stuck in an infinite loop. This dire consequence will of course encourage programmers to get the details right whenever they work with quarks, but in my experience these are the kind of details many people have hard to get right (sometimes because they're applying the data model of LISP to a TeX language which is quite different), so There Will Be Bugs. It would therefore be nice if the bugs could have less draconic consequences. The idea I have proposed is to change the definition of quarks from effectively \def\q_nil{\q_nil} to \def\q_nil{\string\q_nil} (this \string should probably be called \quark_protect:N or some such, but the primitive names are less obscure in a discussion) as a mistaken expansion of the latter does not lead to an infinite loop; even in corny contexts such as \expandafter \expandafter \q_nil (spaces added after control sequence to distinguish from string of character tokens) expansion safely terminates via \expandafter \string \q_nil \string \string \q_nil \string\q_nil % No space after \string, since this \string % is not a control sequence \string\string \q_nil \string\q_nil% Only "other" tokens. Claim 1 continues to hold for this modified definition. Claim 2 can be restored if the test for being \quark_X is changed to \def\temp_a{\string#1} \ifx \temp_a \quark_X (I get the impression that this kind of test should anyway be handled by a expl3-provided command rather than explicit user code, so the number of places to change wouldn't be very large.) So wouldn't it be better if this was changed? Lars Hellström