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=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RDNS_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.4 Received: from authenticated user by zero.zsh.org with local id 1ki37B-000Kiu-QR; Wed, 25 Nov 2020 22:18:17 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f47.google.com) smtp.remote-ip=209.85.221.47; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wr1-f47.google.com ([209.85.221.47]:41716) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ki36s-000KUQ-1p; Wed, 25 Nov 2020 22:17:58 +0000 Received: by mail-wr1-f47.google.com with SMTP id 23so7526wrc.8 for ; Wed, 25 Nov 2020 14:17:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=4ST/aYgSqyc15GumV0WKN/Ab5I/SIOHC4P3P2ksVHu8=; b=nHmETAWdRRpPjWyjqmIJs2Lam4+xHN7KEUzpVWdaRIwRs+sWymBnJWerp36s+yXkkl Y4P7hOoOCHdxgVZYZ1uN2bFARfH4TYm0NVCXPNP+vhfOq9azdOr4xvVJzvUoeVYwmKxj p3wojhQK9Sd3UxBag/0hVVTDDtUKytr26d78FjPXRM7GkVgRC238lwPLJ8Ty8QWo6+B1 wgtk1s+GoNho1F+AKbAN89HvC+h81Xfu6uClhbz3N0KTtAlfuIqOKgNivmRDULu4AZmA WHmWAA7z9qTwpox9PZ1DkErLXH9baVwg+PuweAGk0MD/nOfR9MCIglV61fvQoh/PweDM d3ag== 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; bh=4ST/aYgSqyc15GumV0WKN/Ab5I/SIOHC4P3P2ksVHu8=; b=l2wzy0A8vP1XsCFRXZ4x29VyJ1SPejfq4gQoFbIu55400pTihIc0xVgNXdy3FSMwI4 VYr0NmlSyMXDbH8No8r7RrKv1ZmbdmIYkdru0Z2M7K+sbsakcyibKYNA4LTGo1cp8HwE 6hdPzb9ofBXsJ8BsAz0XU+WPzsvFlEhRl0rgA33BFcT/c1HdL8+Zxf9VQt/zNUR/ndvD ocCxYrk3VBK1mXVdI8cDNNHac+nd5L3YSi5SOM4Dh0WJ28NKFC742CkqH/q8qg7JZRuv i5SKi1Q3Kwjh3J1pgYJsburmuJG51d+R+ohHCFw+MYc47m5mch5XjTLNn6kw6XPJKQ8t V2dA== X-Gm-Message-State: AOAM531PKx3A7VRmYOoAg59Vz8Axb+OXXQmnZbdX9cD3hFMACcdenr6c aIOGuFF7NjB8Mjgq7XUuIAVr4s5sFJiNvW688YI= X-Google-Smtp-Source: ABdhPJzBkSnJRCrF6xf491v5L9wzgk78nJfy0ZOsZBdsxQBKBEpPfVnNBNNb/Rh6Fl+bPs4ZOayDUcXicLSDtIWOujI= X-Received: by 2002:a5d:67c2:: with SMTP id n2mr38203wrw.139.1606342677058; Wed, 25 Nov 2020 14:17:57 -0800 (PST) MIME-Version: 1.0 References: <20201125131921.vay7h3xk5qn4odgg@chazelas.org> In-Reply-To: <20201125131921.vay7h3xk5qn4odgg@chazelas.org> From: Felipe Contreras Date: Wed, 25 Nov 2020 16:17:46 -0600 Message-ID: Subject: Re: More rabbit-holes with unset variables To: Bart Schaefer , Zsh hackers list , Stephane Chazelas Content-Type: text/plain; charset="UTF-8" X-Seq: 47626 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: Archived-At: On Wed, Nov 25, 2020 at 7:19 AM Stephane Chazelas wrote: > > 2020-11-24 23:02:05 -0800, Bart Schaefer: > > I was experimenting with ksh to look deeper into adding behavior to > > ksh_typeset in zsh, and discovered that this example: > [...] > > Sorry I didn't read the full discussion as I just subscribed to > the list, but I did have a look at the differences between local > scope implementations at some point and there are many many > variations between shells. > > I did find zsh was far from being the worst one there. Yes, but the discussion was about inheritance and the behavior of unset, not about what we are discussing here. They did mention the zsh behavior, but that's that's it. I don't think anyone contested what in my opinion is the natural behavior, which is described initially in the description: The variable whose name is specified shall be created as a local variable with name "name". It shall inherit its initial value, as well as the exported and readonly flags, from the variable with the same name in the surrounding dynamic scope if there is one; otherwise, the variable is initially unset. Then, if "=word" is provided, the value of that local variable shall then be set to word. So, the variable is initially unset, *unless* "=word" is provided. Do you think anyone objected to that behavior? Cheers. -- Felipe Contreras