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 r6CG0Sxw008140 for ; Fri, 12 Jul 2013 18:00:29 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx013) with ESMTP (Nemesis) id 0Lrr82-1U264u2ImM-013cxw for ; Fri, 12 Jul 2013 18:00:22 +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 r6CFvCJ6029065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Jul 2013 17:57:12 +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 r6CDw5a0028740; Fri, 12 Jul 2013 17:57:11 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10311264 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 12 Jul 2013 17:57:11 +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 r6CFvAEV016423 for ; Fri, 12 Jul 2013 17:57:10 +0200 Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r6CFv0UM011236 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Fri, 12 Jul 2013 17:57:04 +0200 Received: by mail-vc0-f179.google.com with SMTP id hz11so7769838vcb.24 for ; Fri, 12 Jul 2013 08:57:00 -0700 (PDT) X-Received: by 10.220.111.206 with SMTP id t14mr25165266vcp.77.1373644620269; Fri, 12 Jul 2013 08:57:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.118.6 with HTTP; Fri, 12 Jul 2013 08:56:40 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id r6CFvAEV016424 Message-ID: Date: Fri, 12 Jul 2013 17:56:40 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Michiel Helvensteijn Subject: Propagation of 'global'ness To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by relay.uni-heidelberg.de id r6CFvCJ6029065 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:s3hKwv5L8OA=:MUZgzfsY4cSLiBMFqjbevo HnXdJz8Ue1qpZLwU2LvX8RKRHzwlNWm7JoC4zN1dgZywJEcQ0TUYxHVbBUrq6XLaoHy5mDK WehQgN8OXxgM6jXEOhk2K6zNN/AGqynce1HmK5+7GegXZ8xfbTy/55eep6YrZaoeRlYssXI JsYF8XlZsTzguKfgtcBHv64enly7fAkBdQd9+ykzFQhLW9U76Vm5i+IbrDOVVz/n4km86Md HLD6HtyHo7dquO0aRhG8Lk/7F7rl9+916tT4j7huXfw1G6l2W86RwT/ydyKKjPP1KqHGJ5l HdcYGSgx07IoODci+EqOKv1KWikxgqo34JNTL4CAXijD6AXvYj1oTqA6vKU6tgZjlqNfHAM pkRtZb1vDOX9c09Y052Aq0gW8UlMUctDKNy5EEFRANRgPyEtceo5Kr7ntOfrok4jkyZ19LK 8z54oz4h+h9GnKXcPcYT0V8yMb76sG3Bt5siWhkOnGy0xFmahg7XVmvQ+1iarvtjpBoBo6q r8+Idane7d/fjdGOWQqbi2oNgMLLF+GmJW/7odXkr3f3pEGhRo3WYGPFLtiaV9GoNBWftIU 0yImE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Rt5XkcvmP1Cv8+xaGq2hiZx4HqTK58yI= Status: R X-Status: X-Keywords: X-UID: 7241 Hello all, It occurs to me, as I write my new expl3 datastructure, that the current convention for specifying and propagating 'global'ness of a function (namely, by inserting a 'g' in the name somewhere) leads to either code duplication or to the definition of boilerplace auxiliary functions. It is also too easy to get copy-paste-happy and forget to add a 'g' in an implementation somewhere. I just wanted to suggest an alternative approach. It is compatible with all existing code and might make implementations more readable. Wherever functions now exist in pairs `\prop_put:Nnn` and `\prop_gput:Nnn` I suggest the addition of a function `\prop_sput:NNnn`, where 'global'ness is passed as the first parameter (s stands for scoped). That is the one that would be directly implemented =97in terms of other s-functions. The other two are then implemented in terms of it. The choice of tokens for the first parameter are not important for this idea. It might be one of `\pref_global:D` or `\tex_relax:D` to be used directly at the lowest level, but I'm not yet familiar enough with the l3 core to make a proper decision there. To encapsulate that detail and to save typing, I furthermore suggest that functions like `\cs_new_protected(_nopar)_scoped:NpnNN` are made available. To demonstrate their use, I compare the current `\prop_put` definitions with the new ones I propose: -------------------- Current code -------------------- \cs_new_protected_nopar:Npn \prop_put:Nnn { \@@_put:NNNnn \tl_set:Nx \tl_put_right:Nx } \cs_new_protected_nopar:Npn \prop_gput:Nnn { \@@_put:NNNnn \tl_gset:Nx \tl_gput_right:Nx } \cs_new_protected:Npn \@@_put:NNNnn #1#2#3#4#5 { \tl_set:Nn \l_@@_internal_tl { \s_@@ \tl_to_str:n {#4} \s_@@ { \exp_not:n {#5} } } \@@_split:NnTF #3 {#4} { #1 #3 { \exp_not:n {##1} \l_@@_internal_tl \exp_not:n {##3} } } { #2 #3 { \l_@@_internal_tl } } } -------------------- Proposed code -------------------- \cs_new_protected_nopar_scoped:NpnNN \prop_sput:NNnn #1#2#3#4 { \tl_set:Nn \l_@@_internal_tl { \s_@@ \tl_to_str:n {#3} \s_@@ { \exp_not:n {#4} } } \@@_split:NnTF #2 {#3} { \tl_sset:NNx #1 #2 { \exp_not:n {##1} \l_@@_internal_tl \exp_not:n {##3} } } { \tl_sput_right:NNx #1 #2 { \l_@@_internal_tl } } } \prop_put:Nnn \prop_gput:Nnn ------------------------------------------------------------ Some of the above (like the naming-scheme and the argument specifiers) might even be automatically derived, but for the purpose of this example I didn't want to go that far. Note that `\tl_sset:NNx` and `\tl_sput_right:NNx` are now spelled out in their proper place, so the reader doesn't have to go back and forth to understand what's going on. There is no need for auxiliary functions and errors of omission are unlikely, since omitting #1 would lead to an error. I understand it's a radical change. But it could be introduced gradually. In any case I'd be interested in discussing the pros and cons of the approach. Best, -- www.mhelvens.net