Re: I-D ACTION:draft-daboo-sieve-include-03.txt (fwd)

Kjetil Torgrim Homme <kjetilho@ifi.uio.no> Fri, 26 August 2005 01:27 UTC

Received: from above.proper.com (localhost.vpnc.org [127.0.0.1]) by above.proper.com (8.12.11/8.12.9) with ESMTP id j7Q1RFe4075437; Thu, 25 Aug 2005 18:27:15 -0700 (PDT) (envelope-from owner-ietf-mta-filters@mail.imc.org)
Received: (from majordom@localhost) by above.proper.com (8.12.11/8.12.9/Submit) id j7Q1RFL5075436; Thu, 25 Aug 2005 18:27:15 -0700 (PDT)
X-Authentication-Warning: above.proper.com: majordom set sender to owner-ietf-mta-filters@mail.imc.org using -f
Received: from pat.uio.no (IDENT:7411@pat.uio.no [129.240.130.16]) by above.proper.com (8.12.11/8.12.9) with ESMTP id j7Q1RE1a075422 for <ietf-mta-filters@imc.org>; Thu, 25 Aug 2005 18:27:14 -0700 (PDT) (envelope-from kjetilho@ifi.uio.no)
Received: from mail-mx3.uio.no ([129.240.10.44]) by pat.uio.no with esmtp (Exim 4.43) id 1E8Szu-00035F-Ex; Fri, 26 Aug 2005 03:27:10 +0200
Received: from 250.80-203-78.nextgentel.com ([80.203.78.250] helo=chico.njus.no) by mail-mx3.uio.no with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.43) id 1E8Sxp-0001ys-L5; Fri, 26 Aug 2005 03:25:01 +0200
Subject: Re: I-D ACTION:draft-daboo-sieve-include-03.txt (fwd)
From: Kjetil Torgrim Homme <kjetilho@ifi.uio.no>
To: Aaron Stone <aaron@serendipity.cx>
Cc: Sieve Mailing List <ietf-mta-filters@imc.org>
In-Reply-To: <twig.1125014327.8763@serendipity.palo-alto.ca.us>
References: <twig.1125014327.8763@serendipity.palo-alto.ca.us>
Content-Type: text/plain
Date: Fri, 26 Aug 2005 03:24:55 +0200
Message-Id: <1125019495.15136.148.camel@chico.njus.no>
Mime-Version: 1.0
X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4)
Content-Transfer-Encoding: 7bit
X-UiO-Spam-info: not spam, SpamAssassin (score=-3.701, required 12, autolearn=disabled, AWL 1.11, FORGED_RCVD_HELO 0.05, RCVD_IN_SORBS_DUL 0.14, UIO_MAIL_IS_INTERNAL -5.00)
Sender: owner-ietf-mta-filters@mail.imc.org
Precedence: bulk
List-Archive: <http://www.imc.org/ietf-mta-filters/mail-archive/>
List-ID: <ietf-mta-filters.imc.org>
List-Unsubscribe: <mailto:ietf-mta-filters-request@imc.org?body=unsubscribe>

On Thu, 2005-08-25 at 23:58 +0000, Aaron Stone wrote:
> Both... it's only a single sentence, and a major issue. I think a section
> entitled "Scope" at around 4.2 or 4.1.4 would be best. Also, when the
> issue comes up the user or implementor will have the question, "Why does
> my variable contain weird values after an include?" or "Why can't I access
> a variable set in another file?" and the answer should be explicit to
> those questions.

I'm afraid I don't see how to expound on the sentence, since there _is_
only one scope from that draft's perspective.  the issue is better
discussed in the "include" draft.

> Include will allow more sites to create libraries of common scripts. These
> scripts will want to keep most of their namespace clean and/or protected.
> Prefixed on the variables might work, but a :local / :global mechanism
> would make these protections more explicit.

I'm not opposed to adding a ":local" modifier in the "include" draft.  I
can live with a no-op ":global", too, but I would prefer to not add
redundant elements.

suggested text:

------
4. Interaction with the "variables" extension

        Variables are by default globally scoped, and once set can be accessed until the
        script terminates.  This can lead to unintended name clashes, and to reduce that
        risk, this extension adds a modifier to the "set" action which is available to
        scripts requiring both the "variables" and "include" extensions.

4.1. Modifier ":local"

        A variable value set with the modifier ":local" will shadow the global value until
        the script returns.  This value is unchanged across "include" statements.  In
        contrast with other modifiers for "set", this modifier does not have any particular
        precedence and it does not change the resulting value.

                require "variables";
                set "var" "Hello Kitty";
                if address :localpart "From" "tweety" {
                	set :local "var" "Hello Birdie";
                	set "var" "Tweety says hello";
                }
                
                # At this point, "${var}" can expand to either "Hello Kitty" or "Hello Birdie",
                # never "Tweety says hello".  A script which includes this snippet, will find
                # that "${var}" is either "Hello Kitty" or "Tweety says hello" after the
                # "include", unless it had executed a statement like
                #   set :local "var" "something"
                # prior to the include, in which case "${var}" will still be "something".
-----

the implication here is that you must use :local everytime you set a
local variable.
-- 
Kjetil T.