Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Tue, 11 Aug 2009 13:33:28 +0200 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id n7BBXPtO011025 for ; Tue, 11 Aug 2009 13:33:25 +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 n7BBS7Gr003539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Aug 2009 13:28:07 +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 n7B7w6vI010332; Tue, 11 Aug 2009 13:28:01 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 289498 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 11 Aug 2009 13:28:00 +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 n7BBS0Kp018947 for ; Tue, 11 Aug 2009 13:28:00 +0200 Received: from mordell.elzevir.fr (mordell.elzevir.fr [92.243.3.74]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id n7BBRJtq008133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 11 Aug 2009 13:27:23 +0200 Received: from roth.elzevir.fr (thue.elzevir.fr [88.165.216.11]) by mordell.elzevir.fr (Postfix) with ESMTPS id 6866235EC9 for ; Tue, 11 Aug 2009 13:27:19 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by roth.elzevir.fr (Postfix) with ESMTP id 84E0ABFEB for ; Tue, 11 Aug 2009 13:27:18 +0200 (CEST) User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 References: <4A7921CF.5020803@morningstar2.co.uk> <4A7A1505.4040604@residenset.net> <4A7AD930.2090106@residenset.net> <8516B615-51AA-4D90-BB7D-A9E122AA0335@gmail.com> <4A804317.6050909@morningstar2.co.uk> <4A80508F.3030904@elzevir.fr> <0C83E480-14E3-4CD8-924E-3B9EA602E004@gmail.com> <4A810D6E.5050207@morningstar2.co.uk> X-Enigmail-Version: 0.95.0 OpenPGP: url=http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x50A89B42 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <4A815596.6090308@elzevir.fr> Date: Tue, 11 Aug 2009 13:27:18 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: =?ISO-8859-1?Q?Manuel_P=E9gouri=E9-Gonnard?= Subject: Re: xparse To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <4A810D6E.5050207@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -6.599 () BAYES_00,RCVD_IN_DNSWL_MED X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 11 Aug 2009 11:33:28.0514 (UTC) FILETIME=[8BF72220:01CA1A77] Status: R X-Status: X-Keywords: X-UID: 5880 Joseph Wright a écrit : > I'd wondered about something similar. Looking at xdoc2l3, I think there > are a couple of obvious post-processors. One is \detokenize given a > "design" name (\Detokenize or \MakeString?), and the other is > \MakeHarmless. Perhaps also a de-babel function to deal with active > characters: \PunctuationOther? (Perhaps all of the functions should make > it clear they are argument post-processors? \ArgDetokenize, > \ArgMakeHarmless, etc.) > I agree with this suggestion. IMO, xparse should provide general-use post-processing functions, for the convenience of the user and as example, and let the user define more such functions, with the provided function named \ArgFooBar and a recommandation in the doc that the user-defined preprocessing functions use a similar naming convention. > In any case, I'd imagine any post-processor being a function of one > argument. Internally, they'd do something with a temporary variable, > then put the value of the variable back into the input of the underlying > function defined by in \DeclareDocumentCommand. > That's exactly how I imagine it. > I'd stick to post-processing if given the option. Pre-processing can > lead to things which only work if the defined function is not nested > (back with % again), and I'd prefer not to imply that can work. e-TeX > makes post-processing catcodes possible, so saying "first the argument > is grabbed, then it is modified" seems okay. > Maybe I confused pre/post in my previous message. I always meant post-grabbing and pre-actual-function-call processing :-) > (2) + for \long, upper-case for defaults on optional arguments: > > \DeclareDocumentCommand \foo { o >\MakeHarmless +m } > \DeclareDocumentCommand \foo { O{default} >\MakeHarmless +m } > \DeclareDocumentCommand \foo { +o >\MakeHarmless +m } > \DeclareDocumentCommand \foo { +O{default} >\MakeHarmless +m } > > Both seem to look okay with the post-processing idea added in, I think. > Based on Lars' comments about having a very clear syntax, can we agree > on option (2)? If so, I can implement some of this and then see how it > looks "in practice". > I'm in favour of option 2. It looks more "extensible", if extensions are ever needed in the future. >> In terms of offering expandable optional arguments, I think Joseph's >> "wright" that this can't possibly work with more complex argument types; >> I might be wrong, however. Perhaps this can be something to revisit with >> LuaTeX. > > I'm very reluctant to introduce something where we end up with a complex > warning about what it is for. You can imagine using something like "e = > expandable test for optional argument", but explaining what it is for > and how to use it then becomes very complicated. If we really do want > something like this, I'd think a separate function > (\DeclareExpandableDocumentCommand) might be better. I think I agree. As you pointed out, the capabilities of a purely expandable parser would probably be quite different (no post-processing, less precise peeking at least), so using a different function for defining it makes sense. OTOH, as you mentioned in another message, it would be very interesting to detect trivial cases like only 'm' arguments and use the trivial (hence purely expandable) parser in this case with DeclareDocumentCommand. Manuel.