[Top] [All Lists]

variables: open issue c) NOTIFY compatibility

2003-05-01 16:46:17

the text in the draft reads:

  c) the NOTIFY draft has variables, too.  it would be nice if the
     syntax for the two extensions agreed.  a changed NOTIFY can be
     used on its own without the variables extension, the user simply
     won't be able to configure the notification message to include
     different snippets from the message.

the NOTIFY draft has expired, so it's not a particularily important
issue.  the one thing missing from variables is the ability to
truncate string values, which is done in NOTIFY using the syntax
$var[n]$.  in variables, you can simulate it using regex:

  require ["variables", "regex"];
  if header "Subject" :regex "^(.{,200})" {
    set "short" "${1}";

this does seem a bit hackish.  we could instead do something like

  if header "Subject" :matches "*" {
    set :maxlength 200 "short" "${1}";

(aside: it seems to me that optimising the pattern "*" to do no
matching, only set up ${1}, will be worthwhile, this looks to be a
common idiom for all sorts of things...)

the rationale for the truncation operation in NOTIFY is obviously the
ability to send small excerpts of the message through limited mediums
such as SMS or ICQ.  it may be useful for vacation as well.

regular expressions are better suited for doing general substrings
(which I doubt have much general utility anyway), so I won't suggest
an ":offset N".
Kjetil T.

<Prev in Thread] Current Thread [Next in Thread>