Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Tue, 24 Nov 2009 15:01:23 +0100 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id nAOE1HCZ029482 for ; Tue, 24 Nov 2009 15:01:17 +0100 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 nAODwS27001562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 24 Nov 2009 14:58:28 +0100 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 nAODnvP5020225; Tue, 24 Nov 2009 14:58:26 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 368008 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 24 Nov 2009 14:58:25 +0100 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 nAODwPoT006145 for ; Tue, 24 Nov 2009 14:58:25 +0100 Received: from pluto.open.ac.uk (pluto.open.ac.uk [137.108.145.32]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id nAODw9bm023460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 24 Nov 2009 14:58:13 +0100 Received: from mulberry.open.ac.uk ([137.108.170.73]) by pluto.open.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1NCvuD-0006VO-O0 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 24 Nov 2009 13:58:09 +0000 Received: from KIELDERCMS1.open.ac.uk ([137.108.140.185]) by mulberry.open.ac.uk ([137.108.170.73]) with mapi; Tue, 24 Nov 2009 13:58:09 +0000 Thread-Topic: Passing a dictionary to, for example, the TOC entry formatter Thread-Index: AcptCDZzhWGqS/YNSuin/J9s8a2nTwABMrkw References: <19209.8773.325233.396932@morse.mittelbach-online.de> <4B0BDBC8.3060802@morningstar2.co.uk> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id nAODwPoT006146 Message-ID: Date: Tue, 24 Nov 2009 13:58:09 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: "J.Fine" Subject: Re: Passing a dictionary to, for example, the TOC entry formatter To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <4B0BDBC8.3060802@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -6.599 () BAYES_00,RCVD_IN_DNSWL_MED X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 24 Nov 2009 14:01:23.0591 (UTC) FILETIME=[9B4C2970:01CA6D0E] Status: R X-Status: X-Keywords: X-UID: 6182 Joseph write: > > Frank: I don't understand what you mean by 'the overhead of > processing'.) > > I assume Frank was thinking that we wouldn't want to do everything in a > dictionary manner as some arguments are always needed, and so something > like: > > \def\foo@bar#1#2{% > Title: #1\\% > Name: \DictionaryLookup{#2}{name}\\% > Address: \DictionaryLookup{#2}{address}\\% > } > > will be faster for the explicitly passed #1 than the dictionary items, > independent of how the dictionary is implemented. (I'd assume that a > dictionary would be a single data structure: I'd probably do it as an > expl3 properly list, and then recovering data would certainly add some > processing overhead. However, even a csname expansion as you outline is > an additional overhead compared to an explicitly passed value.) The overhead you point to is slight, and there are worse offenders (such as the LaTeX3 programming language itself). I also suspect that if you do the tests I think you'll find \expandafter\def\csname aa.bb\endcsname{A longish piece of text} \def\mymacro #1{\csname #1.bb\endcsname \mymacro{aa} will be quicker than \mymacro{A longish piece of text} because of the reduced churning of tokens. But I could be wrong. Your revision of my #1{name} to \DictionaryLookup{#2}{name} I strongly disagree with. You've taken something simple that works, and changed it to something that is broken (because it assumes that all maps will be dictionaries). Jonathan The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).