From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12125 invoked from network); 14 Oct 2003 16:46:23 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 14 Oct 2003 16:46:23 -0000 Received: (qmail 3152 invoked by alias); 14 Oct 2003 16:42:53 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6700 Received: (qmail 3090 invoked from network); 14 Oct 2003 16:42:52 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 14 Oct 2003 16:42:52 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.3.58.249] by sunsite.dk (MessageWall 1.0.8) with SMTP; 14 Oct 2003 16:42:51 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h9EGgoi22563 for zsh-users@sunsite.dk; Tue, 14 Oct 2003 09:42:50 -0700 From: Bart Schaefer Message-Id: <1031014164250.ZM22562@candle.brasslantern.com> Date: Tue, 14 Oct 2003 16:42:50 +0000 In-Reply-To: <20031014160041.GA343@DervishD> Comments: In reply to DervishD "Is this an orthodox use of zstyle?" (Oct 14, 6:00pm) References: <20031014160041.GA343@DervishD> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh Users Subject: Re: Is this an orthodox use of zstyle? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 14, 6:00pm, DervishD wrote: } } I think I can use styles to carry state information from one } widget execution to another, so the widget will behave differently } depending on the result of past executions, but: is this an orthodox } use of styles [...]? Typically functions read styles but don't set them, unless they're a special kind of function that's designed to help the user set up his environment (e.g., (in 4.1.1) select-word-style). If the same function will behave differently depending on context (e.g., it might be called as either a normal widget or a completion widget) then styles might be appropriate, but if you don't need to save different state in different contexts, parameters are better. } I know that I can do this with an environment variable but since } the state information can be a bit complex I will need an array, or } maybe a couple for separating information, or even an associative } one You presumably don't want to "export" the widget state parameters (you can't export styles) so it's fine to use arrays and associative arrays for your state. For example, look at the set of parameters used by the zftp functions to maintain state.