Subject: Re: the part argument to "date"

From: Ned Freed <[email-masked]>
Date: Wed, 04 Oct 2006 16:08:50 -0700 (PDT)

(sorry for the delay getting back to this)

> I don't quite like the part argument to "date", since the possible
> values are listed explicitly.  making each of them a tagged argument is
> easier to express in the grammar, and it avoids the problem of
> "${format}" which can fail during run-time.  outline of suggested
> change:

The main reason I chose to make this a positional argument is that tagged
arguments are properly optional and I don't think the type of date test should
be allowed to be optional. This is quite unlike the sitations with other tagged
arguments - they have sensible defaults.

> 4.  Date Test

>    Usage:   date [":zone" <time-zone: string>] [COMPARATOR]
>                  [MATCH-TYPE] [PART] <header-name: string>
>                  <key-list: string-list>
> [...]

> 4.2.  Part argument

>    The "PART" syntax element is defined as follows:

>    Syntax:   ":year" / ":month" / ":day" [...]

>    The optional part argument specifies a particular part of the
>    resulting date/time value to match against the key-list.  If no part
>    argument is given, ":iso8601" is used.  The available parts are:

>    [description of each part suitably edited]

> Ned, I can write a more specific patch if you like, if you send me your
> source.

I'd like to hear from anyone else with an opinion on this. If there's
a consensus to make the change I have no problem, but if its just you any
me who care I'd prefer to stick with my approach.

> (BTW, I changed "parameter" to "argument" since that's what the base
> spec calls them.)

Noted. I'll change things accordingly.

					Ned

---

From: Philip Guenther <[email-masked]>
Date: Wed, 4 Oct 2006 18:22:58 -0600

On Wed, 4 Oct 2006, Ned Freed wrote:
...
> The main reason I chose to make this a positional argument is that 
> tagged arguments are properly optional and I don't think the type of 
> date test should be allowed to be optional.

Tagged arguments != Optional arguments, despite looking the same.  C.f. 
section 2.6 of RFC 3028.

> This is quite unlike the sitations with other tagged arguments - they 
> have sensible defaults.

It's like the :over/:user arguments to the 'size' test...which are tagged 
and not optional.

Philip Guenther

---

From: Kjetil Torgrim Homme <[email-masked]>
Date: Thu, 05 Oct 2006 11:09:50 +0200

> arguments - they have sensible defaults.

my suggested default is "iso8601" which seems useful to me, at least for
a relational comparator.  but if you don't like it, by all means make
PART required.  (I should've called it DATE-PART, btw.)

-- 
Kjetil T.

---

From: Ned Freed <[email-masked]>
Date: Fri, 06 Oct 2006 11:34:17 -0700 (PDT)

> It's like the :over/:user arguments to the 'size' test...which are tagged

Forgot about that one. It's one of things I like least in the base sieve
specification, so this strengthens my resolve to keep this as a positional
argument.

				Ned

---

From: Ned Freed <[email-masked]>
Date: Fri, 06 Oct 2006 11:26:09 -0700 (PDT)

> PART required.  (I should've called it DATE-PART, btw.)

I like having a required tagged argument (AFAIK that would be a first in sieve)
even less than I like giving part a default value.

In any case, unless someone else chimes in with an opinion on this I'm sticking
with a positional argument.

				Ned

---

From: Alexey Melnikov <[email-masked]>
Date: Fri, 06 Oct 2006 19:52:38 +0100

>>PART required.  (I should've called it DATE-PART, btw.)
I prefer to be explicit about the part type.

>with a positional argument.
I don't feel strongly one way or another.