From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1036 invoked from network); 1 Sep 2021 16:22:27 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Sep 2021 16:22:27 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630513347; b=lA2jsZiqUdMz13zl6bkzFvC9kzphJxzRZFDCM+iQxAGNTKed0sdKzyQwnIjqlh2EgQwWybpHji XQ/4S5lLwb4X24PTBFVoyOTo6j4NCJIon7r3RPl2wEZaEM49V4T/KD/lZLDlBDvGtF9ArTEnvv XDXnK2dY5qMhpeBkhtR42RzCy4sIrjFwdxdJdkMTv3WT6RyfIx+oJjvzM9ybL9ASHvA4/pmBfG SFNFcIRucFVvIHN1e+RkA3I2KuV74JpEUJPOIbOl/j3o1xO/cZHv+TAQ97CYjifGrA8SGatc6d OcNpMudVhnOHJV+uj+Ot79gWCpst+6u5Q4aZggC/2KK24A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ua1-f52.google.com) smtp.remote-ip=209.85.222.52; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630513347; bh=24ImwSIoCe4wVgcaJc8SDLjfeMZz9wgOn/aWLJgfFys=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=CZaa5v9U9pL+MD//Gksf0UCCsgv5Dhb/wRgQ8Gyu1yMtx5iS8n12/Mx/JYM8lgEvZY2NYQcA05 lG/WFDzD89Em4tcfZ8TolUghL+Ou5rru1SFm77Fg6m9fVfmn8KrEVBQtK13ZozO/Nc/J7LOAyP nCQqX7f0Z5NPVSSlKS3/7shZaAuCr9N383Psw6VKJZJI3e4TMku7231oCFKvSVuH03ZW9Pbf6T qEyz0KxfS2ZulBQfmrf7YV0mv71S/w/3na3rAt5y7jHKckdFokGuF8/VL4idgq0Juq6m/veTUd P76F5X+eXj6uORaOpYDBYYKAEE7UmeQRLuey7ZrAe8TUhg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=tyLPKHLq6U0TCu6oTh4XR/OtTbE9cWu9hvTcRZr9hu8=; b=Hm6eseQTMbi/+fFqSxL3Moaz06 7bYh657qJmMJsIn2uhVjcH6I9cusxq9ZSm/9DXC6GixHNYju4It06X8D4RIybs4psdKpUFJzJFoq3 H6hoXi7vOdmRfu62oPXJt2RhX627J/o3maTQTL861sOYwM81/J8dkvY91ArzPoPoKo53PKIfouxWv e9pT41OHNi39s+UJRqN9XS0Baq5Xd1W0Irc1TXYtLZtWr3XVKACFSFUa2Eiwh2wtj4es/CnC7KrDA u5BitxBNnWlIkoZmE6TZtTSHUDsnQ/9E0jgNzuQaBZR1qEzmQruX0Uu0YL4YjJYNtbUhKB1ftOOPE guPZWI2w==; Received: from authenticated user by zero.zsh.org with local id 1mLT0N-0006T2-5k; Wed, 01 Sep 2021 16:22:27 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ua1-f52.google.com) smtp.remote-ip=209.85.222.52; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ua1-f52.google.com ([209.85.222.52]:40731) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mLSzy-000644-9D; Wed, 01 Sep 2021 16:22:03 +0000 Received: by mail-ua1-f52.google.com with SMTP id g16so148598uam.7 for ; Wed, 01 Sep 2021 09:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tyLPKHLq6U0TCu6oTh4XR/OtTbE9cWu9hvTcRZr9hu8=; b=Ar+WDtQ47vunsZ/2GShQZXToIljK8RHUNElvs77a4BuU+WFHpgDmeQgvn023P/JREk 62SVXuFMYtYjHyAccuC6VAgG78LiyRqY27EUsH+HAuh4nh38NqnSpyRsq9+ahBE5Zkfq ucFtzEi9AGkQcGOlZL7Cq///tyFdUvLdP7uncM0WHXdi/shAnaFIUDvsw+pGEF32ISDn xlRnNXSMixQBHxOqMXhc/r7HXMqraUHlA6upb7l/+moTgLK+ye5G9t88BOZYVmLHVlbJ DUuppOSOiVX4gyQyd9VAMmvRXxf/NLJ9otg6xNuf07C9Tl6aYmtU2YtILXyKuPasIexO T6Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tyLPKHLq6U0TCu6oTh4XR/OtTbE9cWu9hvTcRZr9hu8=; b=lItXNj6uuzInWXmxzjoos7a5X+kovtEVMBDZuyjbm57XCuJcJpkqG24dzzlRzVFYmo DbAyHfxxoD9+5elcEuld3Qp7O6uE492w+t1vlrVnJc8l0HWAP4SBYSO6xfEnHCd4gL+o FExthDz+aYKaUkg8gzyNJ0K/9cAZwbJsHsfqSDbZLohq/KDNT97iEOqc7c6+SpmGiEdr fyOSMC9uacr+jX6aomFyK/4ClysyTfLv9DQgsFUja5fQlCbazi1pQn4b3jO09mWrLvwh ie8OMjOnyGrixb3g6iB9Rd4PZA7DArEnumWSc/szmMlqxC/uuZiHNVan3plOaCNQPkD4 Bfmg== X-Gm-Message-State: AOAM533SzDZ4W6wd5iWO7rltmOx/519UH46Wb/Ft7SSO8y8QMk8SA+Q6 li6kJ47JYNphkPZx4Jaxhk2H4eVftl/Ib7rgOeL2BMWn8NijYnQ1 X-Google-Smtp-Source: ABdhPJwrAfDmF320szsdle7wdlwgWhrn+1ildiEMX9hCAq01bT8AZTh8YtrFDFN8F/HWsRPV84DpyuaLn7NNzAwMuSY= X-Received: by 2002:ab0:734d:: with SMTP id k13mr412705uap.64.1630513321268; Wed, 01 Sep 2021 09:22:01 -0700 (PDT) MIME-Version: 1.0 References: <20210901140958.GD27958@tarpaulin.shahaf.local2> In-Reply-To: <20210901140958.GD27958@tarpaulin.shahaf.local2> From: Marlon Richert Date: Wed, 1 Sep 2021 19:21:25 +0300 Message-ID: Subject: Re: [BUG] zsh/param/private scoping error To: Daniel Shahaf Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49356 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, Sep 1, 2021 at 5:10 PM Daniel Shahaf wrote: > > Marlon Richert wrote on Wed, Sep 01, 2021 at 14:49:58 +0300: > > This is not how one would expect private variables to behave. Inside > > the inner function, the private variable should be completely out of > > scope and the `tst=` statement should result in the creation of a > > global variable. > > Makes sense to me. A regression test (one with the 'F' flag) would be > welcome, if you've got spare tuits. I was about to create one in V10private.ztst, when I noticed it appears to exist already on lines 230 - 250. :) typeset -A hash_test=(top level) () { local -Pa array_test=(in function) local -PA hash_test=($array_test) () { print X ${(kv)hash_test} hash_test=(even deeper) { array_test+=(${(kv)hash_test}) } always { print ${array_test-array_test not set} ${(t)array_test} } } print Y ${(kv)hash_test} Z $array_test } print ${(kv)hash_test} ${(t)array_test} 1:privates are not visible in anonymous functions, part 3 >X top level >array_test not set ?(anon):4: array_test: attempt to assign private in nested scope F:future revision will create a global with this assignment