Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Mon, 10 Aug 2009 23:11:28 +0200 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id n7ALBTa4032137 for ; Mon, 10 Aug 2009 23:11:29 +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 n7AL7vdj030682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 10 Aug 2009 23:07:58 +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 n7AG7sDD014993; Mon, 10 Aug 2009 23:07:57 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 300528 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 10 Aug 2009 23:07:57 +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 n7AL7vcA005206 for ; Mon, 10 Aug 2009 23:07:57 +0200 Received: from anchor-post-1.mail.demon.net (anchor-post-1.mail.demon.net [195.173.77.132]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id n7AL7kdd030580 for ; Mon, 10 Aug 2009 23:07:49 +0200 Received: from cremornelane.demon.co.uk ([80.177.25.195] helo=[192.168.0.2]) by anchor-post-1.mail.demon.net with esmtp (Exim 4.69) id 1Mac5r-0006so-hB for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 10 Aug 2009 21:07:47 +0000 User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 References: <4A7921CF.5020803@morningstar2.co.uk> <4A8072A6.9080005@elzevir.fr> <4A807946.5060707@morningstar2.co.uk> <4A8083E3.7080009@elzevir.fr> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <4A808C25.7030501@morningstar2.co.uk> Date: Mon, 10 Aug 2009 22:07:49 +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: <4A8083E3.7080009@elzevir.fr> 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: 10 Aug 2009 21:11:28.0134 (UTC) FILETIME=[20377260:01CA19FF] Status: R X-Status: X-Keywords: X-UID: 5869 Manuel Pégourié-Gonnard wrote: >> Remember, though, that *everything* xparse makes is \protected. So a >> function created with xparse will be trying to do \peek_ in an >> expansion situation. > > AFAIK, the beginning of a cell in an alignment is a expansion situation and the > \protected doesn't help here. A quick test confirms this (I'm nothing like an expert on \halign!) > Thinking of it, it's not only about peeking functions, but about the whole > parser, which should (optionally) work purely by expansion, so that no > unexpandable token appears before the development of the actual user macro, thus > allowing to define and effectively use macros involving \omit or \noalign. > > With current \newcommand, the "parser" has this property if there is no optional > argument (for the simple reason that there is no parser in this case) and could > have it if \@testopt were replaced with eg \FE@testopt from etextools in other > cases. > > My question is: is it doable/desirable to allow defining macros having this > property with xparse? It may involve a lot of changes in the implementation, > hence not be worth trying. However, I hope it was worth at least raising the > question. There is a bigger issue than simply \peek_ here. With \newcommand, it is only the first argument that is ever checked, so it is possible to do things in an expandable fashion. I assume that it is feasible to do the same for the first n arguments. However, with xparse there is the possibility to do: \DeclareDocumentCommand \foo { o m o m } % Or whatever syntax! which I don't see being easy (possible?) to do in an expandable way. You've then got to factor in the parallel question about post-processing: this would pretty certainly fail. (That is before you factor in other argument types.) I guess that using LuaTeX this type of thing becomes a lot easier. I wonder if this is a case where as Jonathan Fine suggests we are trying to do things TeX macros simply cannot do because of the nature of TeX (even with the various extensions). -- Joseph Wright