zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: caching mechanism and Re: PATCH Completion for _yum
Date: Wed, 14 Dec 2016 23:23:41 +0900	[thread overview]
Message-ID: <F0775E1F-267F-4A2E-BF7B-DE3DCD500102@kba.biglobe.ne.jp> (raw)
In-Reply-To: <19089.1481715508@hydra.kiddle.eu>


2016/12/14 20:38, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:

> "Jun T." wrote:
> 
>>>> if ( [[ ${+_dput_cfhosts} -eq 0 ]] || _cache_invalid dputhosts ) &&
>>>> ! _retrieve_cache dputhosts; then
>>>> - which makes no sense to me.
> 
>> I guess what is intended by the original code is to be sure to
>> regenerate
>> the data if the cache is invalid, even if the variable _dput_cfhosts
>> already exists in the current zsh.
> 
> That's not what that logic does though. Simplify the line to
>  if ( blah blah... ) && ! _retrieve_cache dputhosts
> 
> and you will see that it only regenerates the cache if _retrieve_cache
> fails. In practice the effect is that no cache is ever considered stale.

E = _dput_cfhosts exists
I = _cache_invalid
R = _retrieve_cache

orig = (!E or I) and !R
new  = !E and (I or !R)

!E I !R  orig  new
T  T  T   T     T
T  T  F   F     T   (1)
T  F  T   T     T
T  F  F   F     F
F  T  T   T     F   (2)
F  T  F   F     F
F  F  T   F     F
F  F  F   F     F

If _cache_invalid returns 0, then _retrieve_cache should return 1
(we can't retrieve from an invalid cache, unless another zsh has
refreshed the cache between the two calls).
So the case (1) above is impossible, and the only difference is the
case (2), i.e., _dput_cfhosts exists but cache is invalid (and
_retrieve_cache returns 1).


Jun


  reply	other threads:[~2016-12-14 14:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 17:37 PATCH Completion for _yum (contains FIXMEs) Paul Seyfert
2016-10-27  1:30 ` Daniel Shahaf
2016-10-31 12:09   ` Paul Seyfert
2016-11-10 10:18     ` Paul Seyfert
2016-11-10 15:49       ` Oliver Kiddle
2016-11-12  0:19         ` PATCH Completion for _yum Paul Seyfert
     [not found]           ` <31607.1478915523@hydra.kiddle.eu>
2016-11-22 19:05             ` caching mechanism and " Oliver Kiddle
2016-12-13 10:10               ` Oliver Kiddle
2016-12-13 16:18                 ` Jun T.
2016-12-13 17:21                   ` Bart Schaefer
2016-12-14 11:38                     ` Oliver Kiddle
2016-12-14 14:23                       ` Jun T. [this message]
2016-12-14 15:03                         ` Oliver Kiddle
2016-12-14 15:23                           ` Jun T.
2016-12-14 17:46                             ` Oliver Kiddle
2016-12-14 20:09                               ` Bart Schaefer
2016-12-15  9:38                               ` Peter Stephenson
2016-12-15 17:15                                 ` Before 5.3.1 (was Re: caching mechanism and Re: PATCH Completion for _yum) Bart Schaefer
2016-12-13 16:38                 ` caching mechanism and Re: PATCH Completion for _yum 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=F0775E1F-267F-4A2E-BF7B-DE3DCD500102@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /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).