Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id r6A7namo020025 for ; Wed, 10 Jul 2013 09:49:37 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx013) with ESMTP (Nemesis) id 0MErf8-1Uzb7I0GjK-00G4wF for ; Wed, 10 Jul 2013 09:49:30 +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 r6A7jdBi028671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Jul 2013 09:45:39 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r69Nk49T019834; Wed, 10 Jul 2013 09:45:37 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10266025 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 10 Jul 2013 09:45:37 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r6A7ZbVF011376 for ; Wed, 10 Jul 2013 09:35:37 +0200 Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r6A7ZSIx023852 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Wed, 10 Jul 2013 09:35:31 +0200 Received: by mail-wi0-f170.google.com with SMTP id ey16so12104942wid.1 for ; Wed, 10 Jul 2013 00:35:28 -0700 (PDT) X-Received: by 10.194.8.163 with SMTP id s3mr17402428wja.41.1373441728500; Wed, 10 Jul 2013 00:35:28 -0700 (PDT) Received: from [139.222.114.129] (che12-j-wright1.che.uea.ac.uk. [139.222.114.129]) by mx.google.com with ESMTPSA id ev19sm34058501wid.2.2013.07.10.00.35.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Jul 2013 00:35:27 -0700 (PDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 References: <51C94FA0.1080803@morningstar2.co.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <51DD0EBD.6080308@morningstar2.co.uk> Date: Wed, 10 Jul 2013 08:35:25 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: l3keys feature request To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:wXPg5XsDyKg=:kcgjUk739ViXI+qT6/d3G+ J+aaZD9mgVO6Qw7NPYbeY/drCrQqlc8wQcCQGFpP/PfQGAK6nqTMgmIrXxtp8EGVxWQ0eXi 1Wx/14yBzYLt7pjUoU2nS/V6SRvf/sdLe2/Bki0Sc+E+IxiL9pr8okut56TvG7AKTL+N46w jRmbH6VCkun2CJochM0Kxy1v+GJzxZe7GB/LJzzz7O1AgO+DuBlzlJ4gTrt4btS/N3YygjF jtxWbAILYNc0fqq4SoSh+2l7/d+XvZdnJAZ10t3DiQuBYVpVt/LXxSivLA5IUDNEp21JbYK QBazlHtEzmQjK2Q3Bs+M/l3S1zXgwWD5jxBGrUCU0Lr0kSEPxEfso44pCNcagUZL4boH5Gw CbNt4CyM8SVxgIufZXu/5PWRB2/c5ByrxMB1qnL/23g3hSZhYwFDjCGwF3Bne9iqFxkX/JC 1coMfup2E0SFh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i8wphR7D5/wRgqwexz1stxax+drRLHd2MInR6s+M3kebNZlVbF CdbI7RoyXG5/94kRZPaKVYlilt5lstZHgIPMHuI8qVG7Np+ZHWnf64HD1koRdV1CrmoV6Ys xOESLXU9H X-UI-Loop:V01:9dI4HmvNfxI=:7QgQ09O6Ht5nAn4u6XxyYVPJXbZcGQBUmPsuzhwSE1U= Status: R X-Status: X-Keywords: X-UID: 7230 On 25/06/2013 22:02, Jura Pintar wrote: >> Here I'm less certain, both in functionality and name terms. I wonder if >> we might have a real-life use case for this? > > I certainly feel no close attachment to the proposed names! :) They were > just the first to pop into my mind. Perhaps \keys_subgroups_set:nnn > (\keys_subgroups_set_known:nnn) or even just \keys_set:nnn > (\keys_set_known:nnn) would be better. You'd be the best judge of what the > closest fit with the current naming scheme is. > > The way I see it, these commands would be a replacement of sorts for > \pgfkeysactivatefamilies{}{} followed by > \pgfqkeysfiltered{}{} and their kin. > > Let's say we wanted to define some user commands that take a key-value list > as an argument, but each command should accept a different subset of the > available keys. With pgfkeys (and L2) we could do > > \pgfkeys{ > /mymodule/.cd, > subgroup-A/.is family, > subgroup-B/.is family, > subgroup-C/.is family, > key-A-i/.code={}, > key-A-i/.belongs to family={/mymodule/subgroup-A}, > ... > key-B-i/.code={}, > key-B-i/.belongs to family={/mymodule/subgroup-B}, > ... > key-C-i/.code={}, > key-C-i/.belongs to family={/mymodule/subgroup-C}, > ... > } > \pgfkeysinstallkeyfilter{ > /pgf/key filters/active families > }{} > \DeclareDocumentCommand\fooABC{ m }{% > \pgfqkeys{/mymodule}{#1}% > \mymodule@fooABC% > } > \DeclareDocumentCommand\fooAB{ m }{% > \pgfkeysactivatefamilies{ > /mymodule/subgroup-A, > /mymodule/subgroup-B > }{\mymodule@AB@filter@stop}% > \pgfqkeysfiltered{/mymodule}{#1}% > \mymodule@fooAB% > \mymodule@AB@filter@stop% > } > \DeclareDocumentCommand\fooBC{ m }{% > \pgfkeysactivatefamilies{ > /mymodule/subgroup-B, > /mymodule/subgroup-C > }{\mymodule@BC@filter@stop}% > \pgfqkeysfiltered{/mymodule}{#1}% > \mymodule@fooBC% > \mymodule@BC@filter@stop% > } > > With the proposed commands, we could do the same in l3keys by writing > > \keys_define:nn { mymodule } > { > subgroup-A / key-A-i .code:n = { } , > ... > subgroup-B / key-B-i .code:n = { } , > ... > subgroup-C / key-C-i .code:n = { } , > ... > } > \DeclareDocumentCommand \fooABC { m } > { > \keys_subgroups_set_known:nnnN { mymodule } > { subgroup-A , subgroup-B , subgroup-C } > {#1} > \l__mymodule_tmp_clist > \__mymodule_fooABC: > } > \DeclareDocumentCommand \fooAB { m } > { > \keys_subgroups_set_known:nnnN { mymodule } > { subgroup-A , subgroup-B } > {#1} > \l__mymodule_tmp_clist > \__mymodule_fooAB: > } > \DeclareDocumentCommand \fooBC { m } > { > \keys_subgroups_set_known:nnnN { mymodule } > { subgroup-B , subgroup-C } > {#1} > \l__mymodule_tmp_clist > \__mymodule_fooBC: > } > > Right now, to achieve this we would need to write something like > > \DeclareDocumentCommand \fooABC { m } > { > \keys_set_known:nnN { mymodule / subgroup-A } {#1} > \l__mymodule_tmp_clist > \keys_set_known:noN { mymodule / subgroup-B } { \l__mymodule_tmp_clist } > \l__mymodule_tmp_clist > \keys_set_known:noN { mymodule / subgroup-C } { \l__mymodule_tmp_clist } > \l__mymodule_tmp_clist > \__mymodule_fooABC: > } > \DeclareDocumentCommand \fooAB { m } > { > \keys_set_known:nnN { mymodule / subgroup-A } {#1} > \l__mymodule_tmp_clist > \keys_set_known:noN { mymodule / subgroup-B } { \l__mymodule_tmp_clist } > \l__mymodule_tmp_clist > \__mymodule_fooAB: > } > \DeclareDocumentCommand \fooBC { m } > { > \keys_set_known:nnN { mymodule / subgroup-B } {#1} > \l__mymodule_tmp_clist > \keys_set_known:noN { mymodule / subgroup-C } { \l__mymodule_tmp_clist } > \l__mymodule_tmp_clist > \__mymodule_fooBC: > } > > We could, of course, define a \__mymodule_keys_subgroups_set:nnn command, > that would map the clist of subgroups and use \keys_set_known:nnN inside, > with only the minimal overhead of an extra pair of of \cs_set_eq:NN on each > iteration, but I do feel adding a kernel command would be the more elegant > solution here. Looking at this, both Bruno and I noticed that if you are allowing a clist then in principal you could simply extend \keys_set:nn to have a list for the first argument. However, I'm not sure that's quite right. If you look at the pgfkeys demo above, what you see is that all of the keys are in the same path: /mymodule/key-A-i /mymodule/key-B-i with the family as a 'secondary path' (or something like that). This means three things: 1) With filtering turned 'off', the keys can all be set in one operation (no need to try different places) 2) The key names are unique 3) If the key is not found, there is one place to look for an unknown handler: /mymodule/unknown On the other hand, the proposed extension to l3keys uses key path for filtering, so we find in contrast 1) The keys can only all be set by actively choosing each subgroup 2) Key names may not be unique, so the order of subgroups becomes important 3) Handling for unknown keys is far from clear (do we look in /mymodule/, /mymodule/subgroup-A/, ...?) I'm going to take a look at how pgfkeys actually handles this. -- Joseph Wright