From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16524 invoked by alias); 7 Jul 2016 16:49:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21741 Received: (qmail 15681 invoked from network); 7 Jul 2016 16:49:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=c/tfTgMRnZvurm9Xo7ZForoDMfBWyztvGKa1UYOEKYU=; b=YUP6nzSbUepvgo6OYrWFyhgdfEgyLHvpth8QCvo8fG4+0RtO2v3V8t2aid0UTqCYIS S5RXUB9H/CaZlt1EuNCroFKfLOKzLm9+9Dmr+XUQRfRSHL4tiPS6Si7bO8Mr4HocJi3K FJM6IOIhBq0isg2eAYRczkWDxqgArErX/MC7bQHf5BeOLaYnU7CI9l6dtBKiwew/8WgL joNl2WMFmihwZFk0nqYCDkdMDyqucKQ5zocglOBCWy75RDCBRAsglYzLfxYpFnIfoRV8 UdFIO4ejB0NU4Wu4wdHAF/1sGU/1b12gCY0oKpR/1pIyggoYepFLAWBxBEeI/lgonu1N 63fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=c/tfTgMRnZvurm9Xo7ZForoDMfBWyztvGKa1UYOEKYU=; b=PYCvSB//0Fg7aToT9c1eBfGJsbo2qaHoGsciXR+EX12n413E5sNKeypO1avx/e+wOt l+ZO0gTtsfubXjsM469xT4ScbugZGI2RwKChJldszANEsYA/KHdgtuA9efPDYztep5bj d0H8qwv4xd7x7JzHpGX2R/LoXmeuUYKg/FX46MUWxTNb5dfbj8PIKodjOMh1ZRcjjLpE Jv2IhUf5hWzcojx3ijvh1Y22gGNoRauKATynu7Lmqy0mf2UUBPA8Yl/rgoougbcl+E1D /uCQ28ac+9WXntcNA2w2EdD6MGb4W1WexHR19tM9T4SHwJschDOcMMcwxdsfPBOMd+Iu V8sA== X-Gm-Message-State: ALyK8tJNllyVsjMOQWImBLGoHNjG5618p65ofDSk2OFl7wdXY4t+KbY2I6IqvTwNOzTWSA== X-Received: by 10.66.178.49 with SMTP id cv17mr1870287pac.157.1467910150537; Thu, 07 Jul 2016 09:49:10 -0700 (PDT) From: Bart Schaefer Message-Id: <160707094921.ZM23499@torch.brasslantern.com> Date: Thu, 7 Jul 2016 09:49:21 -0700 In-Reply-To: <20160707020023.GA3859@tarsus.local2> Comments: In reply to Daniel Shahaf "Re: ${(k)widgets} v. 'zle -la'" (Jul 7, 2:00am) References: <20160705045758.GA18441@tarsus.local2> <160705140120.ZM17175__36700.8317648017$1467752558$gmane$org@torch.brasslantern.com> <20160707020023.GA3859@tarsus.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Daniel Shahaf , zsh-users@zsh.org Subject: Re: ${(k)widgets} v. 'zle -la' MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jul 7, 2:00am, Daniel Shahaf wrote: } } Is the following behaviour also intentional? Testing a key's presence } in the associative array in different ways gives different results: } } % bindkey foo bar } % () { print $(( $argv[(I)bar] > 0 )) } ${(k)widgets} } 1 } % print ${+widgets[bar]} } 0 It's intentional in that hash table entries are parameter values and parameters can exist but be unset, like declaring something local and then unsetting it; $widgets[bar] returns a "value" that is equivalent to "unset" when the widget doesn't exist. It's not intentional in that for normal hash tables there's no way to create such an entry, so the ramifications on e.g. ${+...} of having a special hash where a key that is present is only a placeholder, were not fully thought through. On the other hand it's the only result that accurately represents the situation. -- Barton E. Schaefer