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 r61MXgus027828 for ; Tue, 2 Jul 2013 00:33:43 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx112) with ESMTP (Nemesis) id 0M5Htr-1U1qSG337v-00zWXd for ; Tue, 02 Jul 2013 00:33:35 +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 r61MUdEX013820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 2 Jul 2013 00:30: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 r61M18WE022710; Tue, 2 Jul 2013 00:30:38 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10210020 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 2 Jul 2013 00:30:38 +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 r61MUcVl024883 for ; Tue, 2 Jul 2013 00:30:38 +0200 Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id r61MUTCl028242 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Tue, 2 Jul 2013 00:30:32 +0200 Received: by mail-wi0-f170.google.com with SMTP id ey16so4572492wid.5 for ; Mon, 01 Jul 2013 15:30:29 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.106.72 with SMTP id gs8mr13547948wib.51.1372717829851; Mon, 01 Jul 2013 15:30:29 -0700 (PDT) Received: by 10.194.241.165 with HTTP; Mon, 1 Jul 2013 15:30:29 -0700 (PDT) Content-Type: multipart/alternative; boundary=f46d044519a1a0118f04e07ac64b Message-ID: Date: Mon, 1 Jul 2013 18:30:29 -0400 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: "Joel C. Salomon" Subject: Named options/enumerations (Was re: Defining \bool_case:nn) To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE 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:d7AtL/R+Aqo=:D0djqCYOjkUglSqD+cnvx/ mUTEsvfiaEDoCrqQ1jdcTpnwLSmH2plzyjDKVmMqpiLgM2rdi06m+NDQ9CM2XHPJ8sA/6RK S3nKsIB6dDmnYzfrNk8p7kO92kWLLPg87+xT3mHb2joL4WsQJ35dffNKNn9sLyIziV+pzjj PfY9sgm/GcV0U6McUocn4N6ln3grKDbmkckrBd6UdfuLpAa0Oq/HJqVviYiE4i3pWS0qjaB oc+PHdIwSqqgfhk3yVt18CLTk0IDSRemopxD0oVG/jVRAHBhFGmgN9ik3YxGdhUZyzX/XRO Hi+MgWzOseXCnWyWc5zhSsp4FKOfI7/RUdZucLOJBkGvJECQV0ySw0k4fID70pYeE1JFJ3V WPT+tehdHOvjh4VAqM8eeuFIfFCKKtmX5OKi4GLEuGCg5elc6SZIiv6xW8aHcYn8hJ8atbZ 3JmUDFWz0nyJP2oCgl+cWkYwMEA4XHLCOIma0134/mJ6AcKFiDZQQrbMQyem0rMP/ra76wL 8jvz8nc/l0vrJvs102rFe6I5Ig2e3qRj4uP39CGT+x0x67p9Okzsn8SaERcYXRuek5xjfWV PpZj7Oap6kyTWBXuT/c2eREb2OOs57/EoMVe+Ajtkp2QFS/QT61nEqB6s132N2u6R3Q6OGe 84oQF7e8uXtcJTV31bb+HAHd1PqU8QQF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zcjbTpnExnhliCvHM+15mom4 V5tySgG7+T+jjXxsgeQeOlQnE/rdXfAc+yLUj6ZJ5yLFVQkgXNkmXiIt+HTy52K+UgzRbsW 70fiVB7beuKaOl/lqfNdoYozFD1rR9U= X-UI-Loop:V01:8kQGw0I9hps=:1FSbWqWOLXlfZ0PVttLh0fClvibGd9FUklPpAmnNGy0= Status: R X-Status: X-Keywords: X-UID: 7212 --f46d044519a1a0118f04e07ac64b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable A moment ago, I wrote: > I=E2=80=99ve invited A. Ellett (the fellow who requested \bool_case on Te= X.SE) > to join this thread and explain, but my guess would be that he's got a > group of booleans, only one of which is supposed to be set at any > given time: a selection from a set of mutually-exclusive options, for > example. This use of named options feels like it should be reasonably common in user-facing code, but Expl3 doesn=E2=80=99t have an obvious way of managing= this. I recently asked =E2=80=9CCan I refer to key value in general code?=E2=80= =9D ( http://tex.stackexchange.com/q/120258/2966). My initial thought (somewhat bizarre, I=E2=80=99ll admit) was to save the option is a quark, set equal t= o one of a group of quarks. Enrico pointed me in the direction of string comparisons, and I=E2=80=99ve = moved to using code like this: \keys_define:nn { jcsfonts } { font .choice_code:n =3D \tl_gset:NV \g_jcsfonts_option_tl \l_keys_choice_tl } \str_case:Vnn \g_jcsfonts_option_tl { { cmodern } {} % Computer Modern is LaTeX default { kpfonts } { \RequirePackage{kpfonts} } } { \msg_error=E2=80=A6 } This works, but does not feel entirely satisfactory. Given my C background, I=E2=80=99m tempted to write an enum package, loosely wrapping l3int, to be= used something like this: \enum_case:Vnn \g_jcsfonts_option_enum { \c_jcsfonts_cmodern_enum {} \c_jcsfonts_kpfonts_enum { \RequirePackage{kpfonts} } } { \msg_error=E2=80=A6 } It=E2=80=99s too early for anything to be idiomatic LaTeX3, but what should *become* idiomatic? =E2=80=94Joel --f46d044519a1a0118f04e07ac64b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
A moment ago, I wrote:
> I=E2=80=99ve invited A. Ell= ett (the fellow who requested \bool_case on TeX.SE)
> to join this th= read and explain, but my guess would be that he's got a
> group o= f booleans, only one of which is supposed to be set at any
> given time: a selection from a set of mutually-exclusive options, for<= br>> example.


This use of named options feels like it should = be reasonably common in user-facing code, but Expl3 doesn=E2=80=99t have an= obvious way of managing this.

I recently asked =E2=80=9CCan I refer to key value in genera= l code?=E2=80=9D (ht= tp://tex.stackexchange.com/q/120258/2966). My initial thought (somewhat= bizarre, I=E2=80=99ll admit) was to save the option is a quark, set equal = to one of a group of quarks.

Enrico pointed me in the direction of string comparison= s, and I=E2=80=99ve moved to using code like this:

=C2=A0 =C2=A0 \ke= ys_define:nn { jcsfonts }
=C2=A0 =C2=A0 =C2=A0 { font .choice_code:n =3D= \tl_gset:NV \g_jcsfonts_option_tl \l_keys_choice_tl }

=C2=A0 =C2=A0 \str_case:Vnn \g_jcsfonts_option_tl
=C2=A0 =C2= =A0 =C2=A0 { { cmodern } {} % Computer Modern is LaTeX default
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 { kpfonts } { \RequirePackage{kpfonts} }
<= div>=C2=A0 =C2=A0 =C2=A0 } { \msg_error=E2=80=A6 }

This works, but does not feel entirely satisfactory. Given my C background,= I=E2=80=99m tempted to write an enum package, loosely wrapping l3int, to b= e used something like this:

=C2=A0 =C2=A0 \enum_ca= se:Vnn \g_jcsfonts_option_enum
=C2=A0 =C2=A0 =C2=A0 { \c_jcsfonts_cmodern_enum=C2=A0{}
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 \c_jcsfonts_kpfonts_enum=C2=A0{ \RequirePackage{kp= fonts} }
=C2=A0 =C2=A0 =C2=A0 } { \msg_error=E2=80=A6 }

It=E2=80=99s too early for anything to be idiomatic LaTeX3,= but what should *become* idiomatic?

=E2=80=94Joel
--f46d044519a1a0118f04e07ac64b--