zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Questions (and PATCH: small change to _complete)
Date: Tue, 30 Nov 1999 09:34:50 +0000	[thread overview]
Message-ID: <991130093450.ZM4077@candle.brasslantern.com> (raw)
In-Reply-To: <199911300835.JAA23996@beta.informatik.hu-berlin.de>

On Nov 30,  9:35am, Sven Wischnowsky wrote:
} Subject: Re: Questions (and PATCH: small change to _complete)
}
} Bart Schaefer wrote:
} 
} > I don't see how the array would be "in the way".  It can serve the dual
} > purpose of ordering the groups and of making their names known so that
} > you know what groups it's sensible to ask for when accessing them.
} 
} To be able to define ordering of groups with such an array, we would
} have to use a normal array. If we ever want to give raw access to the
} matches and match-groups added we probably would want to use an assoc
} with the group names as keys and some information about the groups as
} the values (number of first/last match or whatever). Then we would
} have either both or something which will probably be uglier than only
} one assoc. I think. But I may be wrong.

Hmm.  I was thinking that the "some information about the groups" that
you'd want to be able to access would in fact be the matches that are
in that group.  Since we still haven't solved the issues of having an
assoc whose values are arrays, I'd assumed that access to the matches
would not be through an assoc, and hence that you'd need to know what
groups existed.

} > Here's a question ... why isn't $curcontext an array?  Is it really an
} > advantage for it to be a colon-separated string?  And if it is, why not
} > tie the regular array to a colon-array and get both for free?
} 
} I used the colon-separated string because 1) I liked making them look
} a bit like other hierarchical names users already know (pathnames, of
} course) and 2) it was clear from the beginning that they would be used 
} for pattern matching and `*:dvips:-o*' looks more friendly than
} `*" dvips -o"*' or some such.

On the other hand, "dvips:-o" doesn't look like what one might actually
see on the command line, whereas "dvips -o" does.  Dunno whether that's
potentially less confusing, or more so.

} However, if we use an array, we could
} make this look like one of those X.400 names:
} 
}   ( completer=complete command=dvips option=-o argument=1 tag=all-files)

This is somewhat like the ksh syntax for assigning to multiple keys of
an assoc.  I believe that would actually look like

  ( [completer]=complete [command]=dvips [option]=-o ... )

(I resisted attempting this for zsh because it means making the RHS of an
array assignment into a special semantic context in which globbing does
not occur unless the LHS is a normal array, and I didn't feel like doing
that much violence to the parser.)

} Maybe going a bit too far?

It does bring up the possibility of actually making $curcontext an assoc,
although that probably *is* going to far at this point.

} Or maybe not... And would probably call for 
} help by some builtin to define patterns for such names.

Eh?

} But still, saving and restoring these things would be costlier than
} the simple `local curcontext="$curcontext"' we have now.

True.

} And the main question: as long as we don't use the `...=...' syntax
} above, when do we need to access single components? Currently we don't.

It would have the advantage of removing any ambiguity about whether a
given character was part of one of the elements or merely a separator.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-11-30  9:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-30  8:35 Sven Wischnowsky
1999-11-30  9:34 ` Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-11-25  9:54 Sven Wischnowsky
1999-11-25 19:39 ` Bart Schaefer
1999-11-24 10:44 Sven Wischnowsky
1999-11-26  8:46 ` PATCHlet: was: " Sven Wischnowsky
1999-11-26  8:51   ` Sven Wischnowsky
1999-11-26 22:08 ` Peter Stephenson
1999-11-29  9:27   ` Sven Wischnowsky
1999-11-29 17:23     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=991130093450.ZM4077@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).