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 p7KFJ71m030701 for ; Sat, 20 Aug 2011 17:19:08 +0200 Received: (qmail 17807 invoked by alias); 20 Aug 2011 15:19:02 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 20 Aug 2011 15:19:02 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx023) with SMTP; 20 Aug 2011 17:19:02 +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 p7KFGht0025038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 20 Aug 2011 17:16:43 +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 p7JM15Qu027152; Sat, 20 Aug 2011 17:16:42 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1543389 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sat, 20 Aug 2011 17:16:42 +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 p7KFGg8S026962 for ; Sat, 20 Aug 2011 17:16:42 +0200 Received: from mail-gx0-f177.google.com (mail-gx0-f177.google.com [209.85.161.177]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p7KFGa84026690 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Sat, 20 Aug 2011 17:16:40 +0200 Received: by gxk2 with SMTP id 2so3864979gxk.22 for ; Sat, 20 Aug 2011 08:16:36 -0700 (PDT) Received: by 10.236.154.201 with SMTP id h49mr3315551yhk.86.1313853395976; Sat, 20 Aug 2011 08:16:35 -0700 (PDT) Received: from [10.0.1.104] (219-90-219-13.ip.adam.com.au [219.90.219.13]) by mx.google.com with ESMTPS id w1sm2059517yhi.23.2011.08.20.08.16.33 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 20 Aug 2011 08:16:34 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) X-Mailer: Apple Mail (2.1081) X-Spam-Whitelist: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id p7KFGg8S026963 Message-ID: Date: Sun, 21 Aug 2011 00:46:29 +0930 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Will Robertson Subject: couple of l3keys notes To: LATEX-L@listserv.uni-heidelberg.de Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (eXpurgate); Detail=5D7Q89H36p6owQmP6PwN9LCPaiOlRnOFpA7w9luxq2wO1mvNcOJZKSLnvi6LBIozaJuEq qsiJ3zPi1EL/3ab8E9WSnHtQwR8bvc/neSLjRy/OK5B20Rf0I6k43nHSCGjyNxh/Obh1VmSXgY0e 3osf5127SUQKlCDTiyFstP/Fqkb2SYOYNsZJ2f0hBKpvHQusATsIpZImNY=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: 6808 Hi all, I'm in the process of converting fontspec from using xkeyval to the keyval interface in expl3 (l3keys). (The main reason for this, besides to better eat our own dogfood, is to remove some restrictions that xkeyval imposes such as not being loadable before \documentclass.) While doing so I've come up with some notes; comments welcome. I really have enjoyed the conversion, it should be said. What was a little clumsy in xkeyval has generally ended being much cleaner in l3keys. Not to detract from xkeyval, however -- I've been using it for many years and my original code certainly wasn't the cleanest; this is the first time I remember refactoring this options code so it's been mouldering for a while. * * * 1. It seems a bit strange that "generate-choices" requires two calls: \keys_define:nn {fontspec-preparse} { Renderer .choice-code:n = { ... } , Renderer .generate-choices:n = {AAT,ICU,Graphite,Full,Basic} } (Especially when the code is quite long, the final line can get a bit lost.) What do you think of an additional keys function on the lines of: \keys_define:nn {fontspec-preparse} { Renderer .choices:nn = {AAT,ICU,Graphite,Full,Basic}{ ... } } (Actually now I ponder this a little more I seem to remember it was a design goal for l3keys not to have key functions that take multiple arguments...am I recalling correctly? If that is the case, do we want to reconsider this?) 2. There is currently a conditional "\keys_if_exist:nnTF" (and friends). What do you think of, additionally, "\keys_if_choice_exist:nnnTF" for which, say, \keys_if_choice_exist_p:nnn {fontspec-preparse} {Renderer} {AAT} returns true? 3. I think it's generally useful to be able to filter lists of keys into their various modules. (Well, I do it in fontspec and it's the kind of thing that makes inheritance of values easy.) For example, given a keyval list #1 it's often nice to be able to say \keys_set:nn {foo} {#1} ... \keys_set:nn {bar} { } In xkeyval this is done in a simple manner by assigning all unset keys to a macro that can be accessed later; e.g., if it were like this in l3keys: \keys_set:nn {foo} {#1} ... \keys_set:nV {bar} \l_keys_previous_unset_clist You could also imagine doing it more explicitly with a "filtering" function: \keys_filter:nnNN {foo} {#1} \l_keys_included_clist \l_keys_leftover_clist \keys_set:nV {foo} \l_keys_included_clist ... \keys_set:nV {bar} \l_keys_leftover_clist I'll provide my own local definition of the xkeyval approach in fontspec; do you think one of these should be added to l3keys proper? If the former, I imagine it would have to act in concert with the current "unknown" key setting. But I'm more in favour of the latter choice because it would then not conflict with current error handling. 4. Implicit mapping for multiple key choices; what do you think the expected behaviour is here? \keys_define:nn {foo} { key .choice: , key / aaa .code:n = \typeout{aaa} , key / bbb .code:n = \typeout{bbb} , } \keys_set:nn {foo} {key={aaa,bbb}} I would be inclined to disallow "," inside a choice name (if that's not already the case) and automatically map over this list. Is this a bad idea? (Of course, happy to do this manually in my own code.) * * * That's all for tonight! -- Will