Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Fri, 7 Aug 2009 09:22:14 +0200 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id n777MFp7019732 for ; Fri, 7 Aug 2009 09:22:16 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id n777J2Pl030494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 7 Aug 2009 09:19:02 +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 n76M1TXD023658; Fri, 7 Aug 2009 09:18:54 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 286643 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 7 Aug 2009 09:18:54 +0200 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 n777IssQ002084 for ; Fri, 7 Aug 2009 09:18:54 +0200 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 n777Ibfe004733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 7 Aug 2009 09:18:41 +0200 Received: from ueams02.uea.ac.uk (ueams02.uea.ac.uk [139.222.131.131]) by ueamailgate01.uea.ac.uk (8.13.1/8.13.1) with ESMTP id n777IcYp008680 for ; Fri, 7 Aug 2009 08:18:38 +0100 Received: from [139.222.201.17] by ueams02.uea.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1MZJik-0002wB-2E for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 07 Aug 2009 08:18:34 +0100 User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 References: <4A7921CF.5020803@morningstar2.co.uk> <4A7A1505.4040604@residenset.net> <4A7AD930.2090106@residenset.net> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Canit-CHI2: 0.00 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, outgoing) X-CanItPRO-Stream: UEA:outgoing (inherits from UEA:default,base:default) X-Canit-Stats-ID: 27694593 - 926412806498 X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 X-Scanned-By: CanIt (www . roaringpenguin . com) on 139.222.131.184 Message-ID: <4A7BD551.6020804@morningstar2.co.uk> Date: Fri, 7 Aug 2009 08:18:41 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: xparse To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <4A7AD930.2090106@residenset.net> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -6.599 () BAYES_00,RCVD_IN_DNSWL_MED Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 07 Aug 2009 07:22:14.0453 (UTC) FILETIME=[C978F650:01CA172F] Status: R X-Status: X-Keywords: X-UID: 5835 Lars Hellström wrote: > Calc is possibly not the best example anymore, but I assure you it is > not the only kind of preprocessing one might want to make. The basic > idea is that rather than going > > \DeclareDocumentCommand ... { > \cleanup_as_A:Nn\l_tmpa_tl{#1} > \cleanup_as_B:Nn\l_tmpb_tl{#2} > \cleanup_as_C:Nn\l_tmpc_tl{#3} > ... > } > > and refer to the scratch variables \l_tmpa_tl, \l_tmpb_tl, etc. where > the values are needed, we can have #1, #2, etc. be these cleaned-up > values throughout the body. The danger of generic scratch variables is > of course that we don't know whether some other command (that our > command calls) is using them too, whereas command-specific scratch > variables are generally overkill. What about providing some functions which can be used in instead. For example: \DeclareDocumentCommand \foo { m m m } { \cleanup_as_A:Nn \l_foo_arga_tl {#1} \cleanup_as_B:Nn \l_foo_argb_tl {#2} \cleanup_as_C:Nn \l_foo_argc_tl {#3} ... } (An obvious example would be \MakeHarmless or something similar, an interface to \detokenize would be another. Other cases?) I'd then imagine passing the variables through by value (using a V function). As I see it, neither case makes a difference to absorbing arguments. >>> * The ability to have arguments assigned to token lists rather >>> than handed as macro parameters (lets one get around the 9 >>> parameter limit). >> >> >> If we attempt to keep things simple, then I think this is stretching >> the limits of what we'd like \DeclareDocumentCommand to achieve. >> Besides, I've never seen an argument for when >9 arguments are >> actually necessary that couldn't be implemented in some other way >> (e.g., keyval or csv list). > > Not when creating new commands, no, but funny things happen as commands > grow older (from xdoc and derivatives, I have some experience of this). > With specifiers like o and s available, it is very tempting to every > once and then add another feature to a command, by adding another > argument or two; since they're optional, we stay backwards compatible > throughout the process, and in a couple of years the 9 argument limit is > reached. Star-type arguments in particular eat up a lot more parameters > than it feels like they should when one uses the command. > > Assign-to-token-list arguments offers a work-around when the limit is > reached. My experience trying to use xkeyval (where there are *lots* of optional arguments) makes me very wary of making it easy to add too many arguments. There comes a point (probably 5 arguments in many cases) where it is time to think about a different interface. Part of the idea of LaTeX3 is to learn from mistakes made in LaTeX2e, and I think having too many optional arguments fits into that category. -- Joseph Wright