Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id s4M7YQYO008811 for ; Thu, 22 May 2014 09:34:27 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx006) with ESMTPS (Nemesis) id 0Lmw1c-1XEki73LtE-00h2SY for ; Thu, 22 May 2014 09:34:20 +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 s4M7Vwid028344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 May 2014 09:31:58 +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 s4LM14oT027938; Thu, 22 May 2014 09:31:58 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11058033 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 22 May 2014 09:31:58 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s4M7Vv4E016757 for ; Thu, 22 May 2014 09:31:57 +0200 Received: from smtp3.easily.co.uk (smtp3.easily.co.uk [95.130.72.151]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id s4M7Vrrb028264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 22 May 2014 09:31:57 +0200 Received: from [139.222.114.112] (port=49763 helo=[139.222.114.112]) by smtp3.easily.co.uk with esmtpa (Exim 4.43) id 1WnOSv-0002O7-RE for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 22 May 2014 09:35:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 References: <00e701cf7542$114f8870$33ee9950$@post.harvard.edu> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Check-Skipped: Loadavg 12.03 Message-ID: <537DA7E9.7080403@morningstar2.co.uk> Date: Thu, 22 May 2014 08:31:53 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: Trouble with the .bool_set:N property To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <00e701cf7542$114f8870$33ee9950$@post.harvard.edu> 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:QH0t0AHzq54=:8ZgqJIPw56snAtMsMnICzXrzIf 2AJKQKCmgD+GOg4OE87X028ZrJh8m8zu5VRlm0rFyyxu5c7Jua3tVKD3gJjxCOmk2SycRkkpU pU8vP3zQrgvn+cxM+4WmDJc23KkM0LpnewjCEi/xM+rzaf21amCkjE9CZfbaaEYHapg+EbZu8 /xVnF4+iRhAeAbRVK+w7Vwv478WVa9zd7tWR+zJZbIYWFPpcQx4s3/lP5mowfhZlGYEJqw2ek 2YC2Bgcd0BcaRWBfgMwQowW+0wxw0P3/w5TjU1cCRvRK+Re/o0oliiMOcRH3ASEzDtd2A/Ygt mugYnJtGHXWKyR/giquutWAJrh4QE6pxjoKlkYGjVAEH/qVek//3o6Jt3Mw7GLD3DCz0LAGsg 8agQlrVOmz/6d0xYpilqzRLkwRfMHtdK/ol5jindQf6WxkLz5hhPoJjZEhU8U9PAFOfyhJglf 5xqEerozdJTNjm0ZsKQfAsYyMi4vXC/OMH0QpZoHdOH2E9bKbEsvI4fK2GtFRM101BYJsaqWV csIjhlzHrDpc4lx6rXU9N5zk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op:V01:cN35PgLB36Y=:BNOiKmd95wbh4JsZL85uEiS+YXb21nTmyp/tJrO5nk4= Status: R X-Status: X-Keywords: X-UID: 7438 On 21/05/2014 23:14, pintar@POST.HARVARD.EDU wrote: > Based on the discussion at http://tex.stackexchange.com/questions/179180 > there seems to be a problem with the definition of \__keys_bool_set:Nn. > Namely, it is not obvious that the following code should fail > > \keys_define:nn { mymodule } > { > key-1 .choice: , > key-1 / choice-a .bool_set:N = \l_mymodule_choice_a_bool, > key-1 / choice-b .bool_set:N = \l_mymodule_choice_b_bool > } > \keys_set:nn { mymodule } { key-1 = choice-a } > > and yet it hangs because \__keys_bool_set:Nn actually creates a choice > key with the choices 'true' and 'false' under the hood. > > I feel it would be more natural if the code above behaved in the same > way as the following: > > \keys_define:nn { mymodule } > { > key-2 .bool_set:N = \l_mymodule_choice_a_bool > } > \keys_set:nn { mymodule } { key-2 } > > In other words, the code that now hangs should just be setting the > boolean to 'true'. If \__keys_bool_set:Nn and \__keys_bool_set_inverse:Nn > were redefined along the lines of the code below, we'd get that result. It's a bit more complicated than that :-) If you look at the code, any case where someone sets up a 'choice of choices' will fail. That's not good, and so before any worries about booleans specifically I'll fix this more general issue. My feeling is that trying to set up a 'choice of choices' key is an error in the definition rather than at point of use, so I'm minded to trap such cases and issue a error message. Does that sound reasonable? For example, what is something like key-1 .choice: , key-1 / choice-a .choice: , key-1 / choice-a / value-1 .code = ... actually going to achieve? I have an approach in mind: probably will be checked in later today. > Finally, and a lower priority: it might also be useful to add the > properties .bool_set_true:N and .bool_set_false:N as well. For example, > they could work like this: One the specifics of boolean keys, I can see the point here about set_true/set_false as they match 'normal' variable setting. On the other hand, the original design here was to recognise that a boolean key is somewhat 'special': it is a choice from a limited range of values. Moreover, my thinking was that enforcing "true"/"false" as the values avoided the possible need for people to allow for "on"/"off" or "yes"/"no" (I've worried about this in the past). It was also meant to indicate that a boolean key should be one that 'reads' as = (true|false) rather than = (foo|bar) as that seems less useful to the end user (if the options are more complex than true/false then some other description is needed at the documentation level anyway). -- Joseph Wright