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 14473 invoked from network); 4 Oct 2021 04:55:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Oct 2021 04:55:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1633323335; b=UEucMSXPnjjk5rILPjFOvxiTw+GwDKv2ZjXnjmR9f12G1igtIbd2zv1yJTyEQwDvsQDxjByC+N ByHaaK9gDXtaSWehOVI3HNCcFjIo+hNwily/vKiYfk9Lgd2STNJ/l8GGAl0nInlWsOMtS2txgX 1x+WJ9HF76cwhQ7aO0t61T106R/nGIB4Keu7MZTfN2vYhNZh40SAHKa/e/WPruIHl4Xn8bybCQ gQsfCezP4Wtx3tkhgiWruWgcAsI5qzuCjEtGrWyoFBGS6JNEqUpJq2ME6I5EfZFTFBmhrhYTvz Yc89CWvmJdp3DkXEVsckfF5GFYM9/wa7a5LNAVvAuclbJA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vs1-f44.google.com) smtp.remote-ip=209.85.217.44; 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=1633323335; bh=ln2NAstbyRriVy1t4rSaqYvY5wSySA945kCbj4kIB0o=; 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:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=GgzcediltVJ1hZ6VL8zuAp0e6haL3Hn/4uTItLg5jfyuhE5OUoOH2XJdDx+zxSEJsjEH58EeCS hIzZ6WnVID2HMJ7pQjmMMODs3rm+ejjExqxwQd/EPLBtTg7xPYtUjvvtCpMCxNUtDdMwvHSXOT n+RsqTCLQ6lQvnoX3J0bqu38ZLksKsWWGjm8pb/xXLbZLCcF2ldd1RDEx2pXppkDsBhs5FORkh utbihjz4V0j1GQycnfMmqDiYF/06/WwK4COkeSvgqxkQTxisO4WXMdtm+FaTxZekKO5r7Lidsq +71XI33Ei+UvfyzKyZARzLOOp6piQZq5tLP3xDxcErdM2g==; 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:References:In-Reply-To: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=SC8UiPM58+ke/HActBY6/W2my0Y+MEKq6K3A0BW23C4=; b=Kvjkp6fNQ9wQzX+3SHL8WuvsOI pITRZeKdG2dZM129VPz4nCeyToe3WqqTn3Z/w2sW/r2nXPnW1EZbG0aIj95BP2HXGk6oeZeMTqneu g+axcIRasx4++PwwHbmzZ2PanITMSGf8613QokYMJtPrUqvmVel+nnLm+Pe4SZ9iCyAXt3Sbeq5Bw CtbRUZLB/VvVUnrbNCJiqFtMYLqd0hA4DPHC9wIej8OqRKA9eRG4oqKgER8X7/3Sfwri6hwgts+Nb tgWt6+yA/BO+a5aCTq0sVolOdST4BBeE8cJ5apbuAscviUlBjLloJzsGaU1EmzavjRe6asdKlWGXR F23pZiiw==; Received: from authenticated user by zero.zsh.org with local id 1mXG0k-000LV9-DX; Mon, 04 Oct 2021 04:55:34 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vs1-f44.google.com) smtp.remote-ip=209.85.217.44; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vs1-f44.google.com ([209.85.217.44]:36363) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mXG08-000LBv-5l; Mon, 04 Oct 2021 04:54:57 +0000 Received: by mail-vs1-f44.google.com with SMTP id y28so4282166vsd.3 for ; Sun, 03 Oct 2021 21:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SC8UiPM58+ke/HActBY6/W2my0Y+MEKq6K3A0BW23C4=; b=UagJx5Fl6maENiMBMW4rPYpIgIkLZFN8p5phaoOtg/erXpQ82kJB19+eSDb2aOHRIn 4lwwe9lr85lkx6y3N17McXz16wU9BmBtf7ND1XC3Hq46QnBMEq/vTWAAIrLFjnCpjQsM pDcZacqOj9f77C3D/KoqQ0s4nh6Fue78usLyJgqyUfa7J5QyC3EqFKXJQh7KLM+y6HPA HKBXX1CZTYev2SRaqOhaUeV5/Zi7vj2qSWEbrKFL0ZEfSzM0p+oG5R3irmp5tXFUVnxG XGllRugwLCOR/Qv1Dlk+bWnCYTDMNa5arxD+I1sAE9G0bxULlUms8yuzQNfqg1GIJJVf 9ARw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SC8UiPM58+ke/HActBY6/W2my0Y+MEKq6K3A0BW23C4=; b=aJ83DFUHGtP7S/umSoosOCtAeHBxAVpsXG29uDq00zT9b7CQQgHbE0RtAlNPqPiDJl YK9EeIyq2x0bhp80JQOgkYwC8ZiGpCX/PGkemdX26aaDNLgSLmp7xpYvwU/uVUU7PF2G g/goqen4GNp5QmPwEvinAz9KM+P3fYypK6PHiJKDJ15uyt34UJ2Tse5nzGVgFRip+e3e Eu3PN6+0jLvFN9yrHsf0GiVLGC3yKq3AFyeS0GSU2LLTrSu9g6oXgssPXfuAEF4ALDaH s1TbynnVumz20DEB1OH9dgr0bAQLZm8hfeBFJiqnFddDDhpFInt6+9x8bBFTJzqrYeq8 elxw== X-Gm-Message-State: AOAM532IYh/zz5DzVmkjO54kuh3FGkVqtPCRheIX0ghdc+q5ohk9beIH czm9cZnAHcas4a86GxPT/fQYL/vXRtuVrEPLHpY= X-Google-Smtp-Source: ABdhPJyveuv/9Tc+MkvL/x+J9pevwaczjRUjJd36yC+ycWD7EQhqo1sQ+/DbVBS05t/figOb8HQPEHt+cjC8NO5V6b4= X-Received: by 2002:a67:ec59:: with SMTP id z25mr11745650vso.56.1633323294858; Sun, 03 Oct 2021 21:54:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:1109:0:0:0:0:0 with HTTP; Sun, 3 Oct 2021 21:54:54 -0700 (PDT) In-Reply-To: References: From: Mikael Magnusson Date: Mon, 4 Oct 2021 06:54:54 +0200 Message-ID: Subject: Re: [BUG] zsh/param/private scoping error To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49457 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 10/3/21, Bart Schaefer wrote: > On Wed, Sep 1, 2021 at 10:35 AM Bart Schaefer > wrote: >> >> Something else has changed since the implementation of private, I >> think, because this is not what I expected: >> >> top () { private foo=top; mid } >> mid () { typeset -g foo=middle; bot } >> bot () { print $foo } >> functions -t top > > The attached patch addresses this, producing the output I expected: > > +top:0> private foo=top > +top:0> mid > +mid:0> typeset -g foo=middle > +mid:0> bot > +bot:0> print middle > middle > > It also improves the error message in the event that a typeset > attempts to change the scope or properties of a private parameter. > >> Even >> without private, "typeset -g" only reaches as far upwards as the most >> recent local declaration of the name. > > A documentation patch to better explain this is included. As a bonus, > there's also an explanation of why some parameters do not appear in > "typeset -p" output. +private parameters cannot be reliably be reloaded. This also applies This sentence has an extra "be". -- Mikael Magnusson